ranger-1.2.1 用 qiv 代替 feh 显示图片

在 awesome 中,图片浏览器 qiv 好在不用作任何额外设置,就能居中显示,但是我就是 没有办法让 feh 也能在 awesome 中自动居中显示。 ranger 默认使用 feh 打开图片文件,不过可以自定义文件打开方式,编辑/新建 ~/.config/ranger/apps.py,加入下列代码: from ranger.defaults.apps import CustomApplications as DefaultApps from ranger.api.apps import * class CustomApplications(DefaultApps): def app_qiv(self, c): f = c.file if f.image: return self.either(c, 'qiv') @depends_on('qiv')...

2010-12-20 · wuan

附带节假日信息和阴历信息的命令行日历程序

命令行日历程序 cal,功能简单,没有节假日和阴历信息,所以有了 gcal。 包括: 除夕(Chinese New Year’s Day)、清明(Tomb-Sweeping Day)、端午(Dragon Boat Festival)、中秋(Mid-Autumn Festival)等传统节日,以及元旦、五一、十一、儿童节、...

2010-12-17 · wuan

make toc support for jekyll with rdiscount

Table Of Contents(toc) 就是目录,按标题的纵深分类汇总,方便内容间快速跳转。 rdiscount 支持 toc,需要在创建 RDiscount 对象时添加 :generate_toc 参数: markdown = RDiscount.new(content, :generate_toc) 然后通过 toc_content 方法输出 toc 内容: mardown.toc_content Jekyll (<= 0.9.0) 用 rdiscount 作 markdown 语法转换程序时,未能支持 toc 输出。为此我修改了一段代码改进 jekyll 对 toc 的支持: /var/lib/gems/1.8/gems/jekyll-0.8.0/lib/jekyll/converters/markdown.rb markdown.rb | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git markdown.rb markdown.rb index 00c56d7..09c53ed 100644 --- markdown.rb +++ markdown.rb @@ -103,7 +103,8 @@ module Jekyll...

2010-12-16 · wuan

公司 vp10-android.git 仓库使用建议

初始化(clone & checkout -b) 大家首次 clone 了仓库后默认处于 master 分支,建议 大家立即在本地新建一个以 自己 名.姓 命名的分支,作为日常提交的、保存/备份在服务器端的工作目录。姓名 分支在本地建立成功后,应该立即 git checkout 名.姓 切换到该分支进行工作,然 而该姓名分支并不会在服务器端自动创建,需要我们执行一条命...

2010-12-15 · wuan

获取指定时间相对当前时间的时间差的文字描述

#!/bin/sh rt() { time=$(date -d "${1}" +%s) curr=$(date +%s) shift=$(($curr - $time)); if [ $shift -lt 45 ]; then diff="$shift" term="second" # 45 秒前 elif [ $shift -lt 2700 ]; then diff="$(($shift / 60))" term="minute" # 45 分钟前 elif [ $shift -lt 64800 ]; then diff="$(($shift / 60 / 60))" term="hour" # 18 小时前 elif [ $shift -lt 518400 ]; then diff="$(($shift / 60 / 60 / 24))" term="day" # 6 天前 elif [ $shift -lt 1814400 ]; then diff="$(($shift / 60 / 60 / 24))" term="week" # 3 周前 (21 天前) fi if [ $diff -gt 1 ]; then term=$term"s"; else diff="1"; fi echo "$diff $term ago"; }

2010-12-10 · wuan