Skip to content

Instantly share code, notes, and snippets.

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`
@kazu634
kazu634 / ipaddr_ubuntu.sh
Created October 30, 2011 08:22
Get the IP address the DHCP server assigns and make it a static one for Ubuntu
#!/bin/bash
# Set the LANG to C
LANG=C
# Acquiring the IP address
echo "[`date '+%Y/%m/%d %H:%M:%S'`] Acquiring the IP address." >> /tmp/static_ip.log
IP=`/sbin/ifconfig eth0 | grep 'inet addr' | awk '{print $2;}' | cut -f2 -d':'`
#!/usr/bin/env perl
# === Libraries ===
use strict;
use warnings;
use Perl6::Say;
use utf8;
use Encode;