Skip to content

Instantly share code, notes, and snippets.

# run-parts: Runs all the scripts found in a directory.
# keep going when something fails
set +e
if [ $# -lt 1 ]; then
echo "Usage: run-parts <directory>"
exit 1
fi
@valvallow
valvallow / timebomb.sh
Created August 28, 2013 10:04
最終更新日からn日経過したファイルを削除
#!/bin/sh
usage ()
{
echo 'usage: '`basename "$0"` '[-h|-d] days target-directory'
echo ' options: '
echo ' -h : show this help'
echo ' -d : force delete'
exit;
}
#!/usr/bin/env gosh
(use file.util)
(use net.twitter)
(use gauche.threads)
(use gauche.parseopt)
(define (usage cmd)
(print "Usage: " (sys-basename cmd) " [option ...] message")
(print " h|help : Show this help")
#!/usr/bin/env gosh
(use file.util)
(use net.twitter)
(use gauche.threads)
(use gauche.parseopt)
(define (usage cmd)
(print "Usage: " (sys-basename cmd) " [option ...] message")
(print " h|help : Show this help")
@valvallow
valvallow / ab2maru.scm
Last active December 18, 2015 19:49
Unicodeで遊ぶ http://d.hatena.ne.jp/rahaema/20130622/p1 をgaucheで
(use srfi-13)
(use srfi-14)
(define (ab->maru str)
(string-map
(^c (let1 i (char->integer c)
(integer->char
(cond ((char-set-contains? #[a-z] c)
(+ (- i (char->integer #\a)) #x24d0))
((char-set-contains? #[A-Z] c)
#!/bin/sh
BASE_DIR=`pwd`
if [ "$#" -eq 0 ] ; then
echo 'Usage: ' "$0" ' dirname ...'
exit
fi
for dir in $@
@valvallow
valvallow / marquee.scm
Created June 17, 2013 15:32
marquee in the shell
#!/usr/local/bin/gosh
(use gauche.parseopt)
(use gauche.process)
(use srfi-1)
(use srfi-13)
(define (usage cmd)
(print "usage: " cmd " [option] ... input")
(print " options:")
#!/usr/local/bin/gosh
(use gauche.parseopt)
(use gauche.uvector)
(use srfi-13)
(define (usage cmd)
(print "usage: " cmd " [option ...] string length")
(print " options:")
(print " h|help print this help")
#!/bin/sh
SLN_NAME=""
while getopts vVn OPT
do
case $OPT in
"v" | "V" ) VERBOSE="TRUE"
shift
;;
git config --global alias.his "log --pretty='format:%C(yellow)%h%Creset %C(magenta)%<(22,trunc)%cd%Creset %><(11,trunc)%C(black bold)%ar%Creset | %Cgreen%<(10)%an%Creset | %<(130,trunc)%s %Cred%<(45,trunc)%d%Creset' --date=iso --all -n 15"