代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
Perl
】
根据使用频率输出dmenu的结果
作者:
施宇迪
/ 发布于
2011/11/29
/
1389
<div>!/usr/bin/perl</div> <div> sydi_dmenu --- # # Filename: sydi_dmenu # Description: This script make dmenu more 'smart' choosing program # run by making a counter to each command. Simplely use # this script as how u r using dmenu. # Author: Sylvester Y. Shi # Maintainer: Sylvester Y. Shi # Created: 一 11月 28 21:15:47 2011 (+0800) # Version: 0.1 # Last-Updated: 一 11月 28 21:27:52 2011 (+0800) # By: Sylvester Y. Shi # Update #: 16 # URL: <a href="http://blog.sydi.org/">http://blog.sydi.org/</a> # Keywords: dmenu, smart, perl # Compatibility: dmenu 4.4.1+, or less than it, but without test. # #</div> <div> Commentary: # varible $data_file is the data file using this script, change it # as u like to satified ur need. # # The script is writtern by `sylvester' for fun, u can contact to me # as follow. # mail: <a href="mailto:cedsyd@gmail.com">cedsyd@gmail.com</a> # weibo: sylvester324</div> <div> # Change Log: # 28-Nov-2011 Sylvester Y. Shi # Last-Updated: 一 11月 28 21:23:47 2011 (+0800) #2 (Sylvester Y. Shi) # Create File. # #</div> <div> # *This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, Fifth # Floor, Boston, MA 02110-1301, USA. # #</div> <div> Code:</div> <div>use autodie;</div> <div>my $data_file = "/home/sylvester/bin/data.dmenu.sydi"; my @bin_dirs = split /:/, $ENV{PATH}; my %all_bins;</div> <div>sub check_data_file { system("touch $data_file") if not -e $data_file; } <div>sub load_data { open my $fh, "lsx @bin_dirs 2>/dev/null |"; my %now_bins = map { chomp; $_ => 0 } <$fh>; close $fh;</div> <div> open my $fh_old, "<$data_file"; my %old_bins = map { chomp; split / /,$_ } <$fh_old>; close $fh_old;</div> <div> %all_bins = (%now_bins, %old_bins); } <div>sub sort_bins { my @bins = keys %all_bins; my @sorted_bins = sort { $all_bins{$b} cmp $all_bins{$a} } @bins; } <div>sub get_bins_str { my $sorted_bins = shift; my $bins_str; foreach (@$sorted_bins) { $bins_str .= "$_\n"; } return $bins_str; } <div>sub call_dmenu { my $bins_str = shift; my @args = map { "'$_'" } @ARGV;</div> <div> open my $fh, "echo '$bins_str' | dmenu @args |";</div> <div> my $cmd = <$fh>; chomp $cmd; $all_bins{$cmd}++ if $cmd ne '' and exists $all_bins{$cmd}; print $cmd; } <div>sub keep_in_data_file { open my $fh_old, ">$data_file"; while (my ($key, $value) = each %all_bins) { print $fh_old "$key $value\n"; } close $fh_old; } <div> check_data_file; load_data; my @sorted_bins = sort_bins; my $bins_str = get_bins_str \@sorted_bins; call_dmenu $bins_str; keep_in_data_file;</div> <div> # # sydi_dmenu ends here </div>
试试其它关键字
dmenu
同语言下
.
获取本机所有IP和设备的绑定情况
.
生成隨機密碼
.
取文件的最后修改时间
.
获取本机所有IP和设备的绑定情况
.
将perl脚本变成乱糟糟的一团
.
从 HTML网页中解析出链接
.
使用 HTTP::Request 请求 URL 并将响应保存到文件
.
使用指定的User-Agent抓取网页
.
使用 Net::SMTP发送邮件
.
编写的一个简单 Web服务器
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
施宇迪
贡献的其它代码
(
1
)
.
根据使用频率输出dmenu的结果
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3