November 27, 2017 / Kyle Sun / 0 Comments
because I can.. (but you really shouldn’t)
#!/usr/bin/expect -f
spawn oathtool --base32 --totp $KEY -d 6
expect -re \\d+
set CODE $expect_out(0,string)
spawn ssh $SERVER
expect "Verification code:"
send "$CODE\n"
expect "Password:"
send "$PASSWORD\n"
interact
September 18, 2012 / Kyle Sun / 0 Comments
Tmux
Tmux是screen的替代品, 因为screen项目基本已死, 又buggy, code又很臃肿, 所以就有了Tmux. Tmux已经存在有一段时间了, 不过一直没有特别需求从screen转过去. 最近因为想着要竖着切屏就换了. 基本用得功能都差不多, Tmux可以自动更新title也是很有用的.

Z – jump around
https://github.com/rupa/z
Z是帮助用户快速跳转到想去的dir的. 不知道有多少次想跳转一个文件夹的时候要打一段很长的前缀, 这个小script就轻松解决这一问题: 只要输入这个dir的特征字段既可.

HuffShell
https://github.com/paulmars/huffshell
这也是个很实用的工具, 通过对.bash_history的分析来设定常用的alias, 来减少击键, 从而增加效率.
Lift.do
这是一个iOS App, 从最开始private beta的时候就开始关注了, 目的是帮助用户建立良好的习惯, 可以设定一系列的目标每天签到, 并且可以给与完成同样目标的人一个(like). UI很简洁, 用起来效果很好. 我因此开始了睡前仰卧起坐, 起床俯卧撑, 并且每天吃早餐等好习惯.

Workflowy
https://workflowy.com/?ref=aa2344c.tw (Warning: 链接是含我的邀请码的, 双方可以额外增加一些使用量)
Workflowy是一个极简主义的to-do list App, 没有Catalog, 没有reminder, 没有repeat event, 只有非常basic的list, sublist和tag. 从复杂的to-do list还原到最简单的list, 最大的收获是input变得容易很多, 有兴趣可以试一下.
June 26, 2009 / Kyle Sun / 0 Comments
void
June 8, 2009 / Kyle Sun / 0 Comments
Ref: http://linuxtoy.org/docs/guide/ch33s03.html
.zshrc
#screen integration to set caption bar dynamically
function title {
if [[ $TERM == “screen” || $TERM == “screen.linux” ]]; then
# Use these two for GNU Screen:
print -nR $’\033k’$1$’\033’\\\
print -nR $’\033]0;’$2$’\a’
elif [[ $TERM == “xterm” || $TERM == “urxvt” ]]; then
# Use this one instead for XTerms:
print -nR $’\033]0;’$*$’\a’
#trap ‘echo -ne “\e]0;[email protected]$HOSTNAME: $BASH_COMMAND\007″‘ DEBUG
fi
}
#set screen title if not connected remotely
function precmd {
title “`print -Pn “%~” | sed “s:\([~/][^/]*\)/.*/:\1…:”`” “$TERM $PWD”
echo -ne ‘\033[?17;0;127c’
}
function preexec {
emulate -L zsh
local -a cmd; cmd=(${(z)1})
if [[ $cmd[1]:t == “ssh” ]]; then
title “@”$cmd[2] “$TERM $cmd”
elif [[ $cmd[1]:t == “sudo” ]]; then
title “#”$cmd[2]:t “$TERM $cmd[3,-1]”
elif [[ $cmd[1]:t == “for” ]]; then
title “()”$cmd[7] “$TERM $cmd”
elif [[ $cmd[1]:t == “svn” ]]; then
title “$cmd[1,2]” “$TERM $cmd”
else
title $cmd[1]:t “$TERM $cmd[2,-1]”
fi
}
.screenrc
hardstatus alwayslastline “%{=b}%{-b}%{R}[%{=b B}%-w%{=b BK}%>%n %t%{-}%+w%{-b}%< %=%{R}][%{-b}%{M}%m-%d %D %{G}%c%{R}]"
December 18, 2008 / Kyle Sun / 0 Comments
今天新学一招,彩色man,让man变得多彩起来。说出来其实很简单,在~/.bashrc里增加一下内容
# For colourful man pages (CLUG-Wiki style)
export LESS_TERMCAP_mb=$’\E[01;31m’
export LESS_TERMCAP_md=$’\E[01;31m’
export LESS_TERMCAP_me=$’\E[0m’
export LESS_TERMCAP_se=$’\E[0m’
export LESS_TERMCAP_so=$’\E[01;44;33m’
export LESS_TERMCAP_ue=$’\E[0m’
export LESS_TERMCAP_us=$’\E[01;32m’
就这么简单,效果如下图:

ref: http://plog.longwin.com.tw/ost/1/409