Skip to content

Instantly share code, notes, and snippets.

## zsh/growl integration: any command that takes longer than 5 seconds
## will trigger a growl notification when it completes.
## https://github.com/patbenatar/dotfiles/blob/master/zsh/growl.zsh
if growlnotify -h &>/dev/null; then
preexec() {
zsh_growl_cmd=$1
zsh_growl_time=`date +%s`
}
# google_translate [-j, -e]
# $ google_translate -e power line
function google_translate() {
local str opt arg
str=`pbpaste` # clipboard
arg=`echo ${@:2} | sed -e 's/ */+/g'` # argument
en_jp="?hl=ja&sl=en&tl=ja&ie=UTF-8&oe=UTF-8" # url
case "$1" in
" GistPaste
" Gistへの投稿後、「:GistPaste」で投稿のHTMLタグを貼り付け
" http://nukino.github.com/blog/2012/01/16/gist_vim/
func! s:paste_gist_tag()
let mx = 'http[s]\?://gist.github.com/\([0-9]\+\)'
" +または"レジスタの中身を検索する
let regs = [@+,@"]
for r in regs
let mlist = matchlist(r, mx)
if ( len(mlist) > 2 )
"" 一番上(3行目)のツイートを通知する
"" https://gist.github.com/rhysd/4201877
"" NeoBundle 'supermomonga/shiraseru.vim'
" 自動更新間隔(秒)
let s:tweetvim_update_interval_seconds_growl = 4
let s:tweetvim_timestamp_growl = reltime()[0]
function! s:tweetvim_autoupdate_growl()
#!/bin/bash
while :
i=`pbpaste`
do
if [ "$(pbpaste)" != "$i" ];then
pbpaste;
echo;
fi
done
sleep .5
#! /usr/bin/env ruby
# https://gist.github.com/hitode909/1239124
# require 'systemu'
last = nil
loop {
current = `pbpaste`
if last != current
puts current
function! s:update_cbuffer_growl()
ruby << EOC
line = VIM::Buffer.current.line
system("growlnotify -a MacVim -m '#{line}'")
EOC
endfunction
function! s:update_cbuffer()
augroup update-cbuffer
autocmd!
#!/bin/sh
echo "
tell application \"iTerm\"
activate
tell current session of current terminal
set transparency to $1
end tell
end tell
" | osascript -
#!/usr/bin/gosh
(use gauche.termios)
;; http://d.hatena.ne.jp/rui314/20070319/p1
;; 端末を非カノニカルモードに変更して1文字を読む手続き。
;; リターンするまえに端末のモードを元に戻す。
(define (read-single-char port)
(let* ((attr (sys-tcgetattr port))
(lflag (slot-ref attr 'lflag)))
(dynamic-wind
(lambda ()

###tool

$ sudo port install graphicsmagick ffmpeg imagemagick

###ffmpeg

####mp4,flv,swf -> mp3