Skip to content

Instantly share code, notes, and snippets.

;; 第1回 Scheme コードバトン
;;
;; ■ これは何か?
;; Scheme のコードをバトンのように回していき面白い物ができあがるのを楽しむ遊びです。
;; 次回 Shibuya.lisp で成果を発表します。
;; Scheme 初心者のコードを書くきっかけに、中級者には他人のコードを読む機会になればと思います。
;;
;; ■ 2 つのルール
;;
;; (1)自分がこれだと思える変更をコードに加えて2日以内に次の人にまわしてください。
Snippet development
Quickly finding snippets
There are some ways you can quickly find a snippet file:
*
M-x yas/new-snippet
Prompts you for a snippet name, then tries to guess a suitable directory to store it, prompting you for creation if it does not exist. Finally, places you in a new buffer set to snippet-mode so you can write your snippet.
#!/usr/bin/env perl
# === Libraries ===
use strict;
use warnings;
use Perl6::Say;
use utf8;
use Encode;
@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':'`
#!/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 / 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 \;
@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
" <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 / 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')')')
#!/usr/bin/env perl
# for formality's sake
use strict;
use warnings;
# reading directories
opendir(DIR,'.') or die "$!";
my $index = 0;