Skip to content

Instantly share code, notes, and snippets.

@nukino
nukino / test4.vim
Created January 17, 2012 22:24
[20120118-0724]test4.vim/文字列引数渡し方式の確認
func! s:func1(strg)
endfunc
func! TestFunction()
let loopcnt = 1000000
let st_time = reltime()
let i = 0
let ss = ""
while i < loopcnt
call s:func1(ss)
@nukino
nukino / .bashrc
Created January 31, 2012 02:01
[20120131-1100].bashrc/bash_completion更に高速化
[ -n "$USER_COMP_DIR" ] || USER_COMP_DIR=~/cygwin/bash_completion.d
[ -n "$USER_COMP_FILE" ] || USER_COMP_FILE=~/cygwin/bash_completion
if [[ -d $USER_COMP_DIR && -r $USER_COMP_DIR && -x $USER_COMP_DIR && \
-f $USER_COMP_FILE && -r $USER_COMP_FILE ]]; then
# /etc/bash_completionより
UNAME=$( uname -s )
# strip OS type and version under Cygwin (e.g. CYGWIN_NT-5.1 => Cygwin)
UNAME=${UNAME/CYGWIN_*/Cygwin}
@nukino
nukino / .bashrc
Created January 31, 2012 02:04
[20120131-1103].bashrc/bash_completion高速化
if [[ -z "$BASH_COMPLETION_DIR" && -f /etc/bash_completion ]]; then
USER_COMP_DIR=~/cygwin/bash_completion.d
BASH_COMPLETION_DIR=$USER_COMP_DIR
BASH_COMPLETION_COMPAT_DIR=$USER_COMP_DIR
unset USER_COMP_DIR
. /etc/bash_completion
fi
@nukino
nukino / setup_env.bat
Created January 31, 2012 13:08
[20120131-2208]setup_env.bat/Cygwin環境変数設定
rem CygwinシンボリックリンクをWindowsショートカットにする場合コメントアウト解除
rem setx CYGWIN winsymlinks
rem makeの動作モード
setx MAKE_MODE unix
rem CRを無視する
setx SHELLOPTS igncr
@nukino
nukino / .bashrc
Created February 1, 2012 02:51
[20120201-1151].bashrc/
if [ -d "${HOME}/cygwin/bin" ] ; then
PATH="${HOME}/cygwin/bin:${PATH}"
fi
@nukino
nukino / apt-cyg.diff
Created February 1, 2012 19:49
[20120202-0448]apt-cyg.diff/大文字、小文字を区別しない
--- apt-cyg 2010-04-28 03:55:43.000000000 +0900
+++ ~/cygwin/bin/apt-cyg 2012-01-24 07:24:17.433141300 +0900
@@ -242,11 +242,11 @@ case "$command" in
do
echo ""
echo Searching for installed packages matching $pkg:
- awk '/[^ ]+ [^ ]+ 0/ {if ($1 ~ query) print $1}' query="$pkg" /etc/setup/installed.db
+ awk -v IGNORECASE=1 '/[^ ]+ [^ ]+ 0/ {if ($1 ~ query) print $1}' query="$pkg" /etc/setup/installed.db
echo ""
echo Searching for installable packages matching $pkg:
@nukino
nukino / wvi.sh
Created February 2, 2012 00:58
[20120202-0958]wvi.sh/gVimで編集
#!/bin/bash
if [[ $# = 1 && ! -f $1 ]]; then
#改行コードunix 同期実行
gvim -c "setl ff=unix" `cygpath -w $1`
#ファイルが存在するならパーミッション設定
if [ -f $1 ]; then
#umaskの結果を参照する場合(要bcコマンド)
um=`umask`
perm=`echo "ibase=8; obase=8; 666 - $um" | bc`
chmod $perm "$1"
@nukino
nukino / .bashrc
Created February 2, 2012 06:31
[20120202-1530].bashrc/英語man表示コマンド
#英語のmanページを表示
alias eman='LANG=en_US LC_ALL=en_US /usr/bin/man'
@nukino
nukino / .bashrc
Created February 2, 2012 07:08
[20120202-1608].bashrc/ls等色分け表示
if [ -x /usr/bin/dircolors ]; then
test -r ~/cygwin/.dircolors && eval "$(dircolors -b ~/cygwin/.dircolors)" || eval "$(dircolors -b)"
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias ls='ls -hF --color=auto' # classify files in colour
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
@nukino
nukino / externalhelp.vim
Created February 18, 2012 05:14
[20120218-1414]externalhelp.vim/vim外部ヘルプ実行スクリプト
let g:external_hlp_hhhexe = get(g:, 'external_hlp_hhhexe', '')
let g:external_hlp_winhlpexe = get(g:, 'external_hlp_winhlpexe', '')
" 引数1:キーワード種類
" 0:カーソル位置をキーワードとする
" 1:キーワード入力
" 2:引数2をキーワードとする
"
" 引数2:キーワード
"