Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
########################################
# Name: Kazuhiro MUSASHI
#
# about:
#
# Usage:
#
# Author:
if has('mac')
augroup templateload
autocmd!
autocmd BufNewFile *.sh 0r ~/.vim/template/skelton.sh
autocmd BufNewFile *.pl 0r ~/.vim/template/skelton.pl
autocmd BufNewFile *.scm 0r ~/.vim/template/skelton.scm
augroup END
endif
m4/.seedlock : m4/seed.m4
@echo "Generating the macro..."
@m4 m4/seed.m4
@touch m4/.seedlock
m4/seed.m4 : src/header src/procedure src/footer
@echo "Generating seed m4 file..."
@bin/template.pl > m4/seed.m4
#!/usr/bin/env perl
# for formality's sake
use strict;
use warnings;
# Handling the options
use Getopt::Long;
# Default value
#!/usr/bin/env perl
# for formality's sake
use strict;
use warnings;
# reading directories
opendir(DIR,'.') or die "$!";
my $index = 0;
@kazu634
kazu634 / test.m4
Created December 8, 2011 11:37
for-each ... m4
# foreach(x, (item_1, item_2, ..., item_n), stmt)
define(`foreach', `pushdef(`$1', `')_foreach(`$1', `$2', `$3')popdef(`$1')')
define(`_arg1', `$1')
define(`_foreach',
`ifelse(`$2', `()', ,
`define(`$1', _arg1$2)$3`'_foreach(`$1', (shift$2), `$3')')')
" <statusline>
let g:gitCurrentBranch = ''
function! CurrentGitBranch()
let cwd = getcwd()
cd %:p:h
let branch = matchlist(system('/usr/bin/env git branch -a --no-color'), '\v\* ([0-9A-Za-z\/]*)\r?\n')
execute 'cd ' . cwd
if (len(branch))
let g:gitCurrentBranch = '[git:' . branch[1] . ']'
else
@kazu634
kazu634 / install.sh
Created November 26, 2011 12:36
シェルスクリプトがあるディレクトリ配下の.filesをホームディレクトリにコピー
#!/bin/bash
# finding out the shell script directory
CURDIR=`dirname $0`
# copying the .files as a soft link
find $CURDIR -type f -name ".*" -maxdepth 1 -print0 | xargs -0 -J % ln -s % $HOME 2>/dev/null
@kazu634
kazu634 / gist:1380314
Created November 20, 2011 14:29
git管理下の空ディレクトリに.gitkeepを作成するスクリプト
#!/bin/bash
/usr/bin/find . -type d -name .git -prune -p -type d -empty -print -exec touch {}/.gitkeep \;
#!/bin/bash
for FILE in `find . -name "*" -maxdepth 1`
do
case $FILE in
*.scm) echo $FILE ;;
esac
done
for FILE in `find . -name "*" -maxdepth 1`