Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
plot = open("|gnuplot","w")
plot.puts "set xrange [0:6.3]\n"
for i in 1..600
plot.puts "plot sin(x - #{i * 0.1}) notitle\n"
plot.flush
sleep(1.0/60.0)
end
@phelrine
phelrine / yasnippet-popup.el
Created January 27, 2011 15:16
yas/popup-prompt
(require 'popup)
(defun yas/popup-prompt (prompt choices &optional disp-fn)
(defun memq-index (elem list)
(defun memq-index-iter (list index)
(cond ((atom list) (and (eq elem list) index))
((eq elem (car list)) index)
(t (memq-index-iter (cdr list) (+ 1 index)))))
(memq-index-iter list 0))
(let* ((formatted-choices
#!/bin/sh
convert -coalesce -delay 0 -loop 0 -deconstruct \
\( -geometry 48x48 -roll +1+0 $1 \) \
\( -geometry 48x48 $1 \) ${1%%.*}-furueru.gif
CC = g++
OBJS = linpack.o com.o randlib.o
.PHONY: all clean
all: librandlib.a
librandlib.a: $(OBJS)
ar cr librandlib.a $(OBJS)
ranlib librandlib.a
@phelrine
phelrine / divide.scm
Created June 11, 2011 14:52
ファイル分割
#!/usr/bin/env gosh
(use util.match)
(use file.util)
(use gauche.sequence)
(define (usage program)
(print #`"usage: ,|program| filename num..."))
(define (main args)
@phelrine
phelrine / rainbow-hl-line.el
Created June 28, 2011 22:34
rainbow highlight line
;;; (require 'rainbow-hl-line)
;;; (rainbow-hl-line-mode 1)
(defgroup rainbow-hl-line nil "rainbow-hl-line custom group")
(defcustom rainbow-hl-line-color-list
(list "red4" "orange4" "yellow4" "green4" "blue4" "magenta4")
"color list"
:type '(repeat string)
:group 'rainbow-hl-line)
@phelrine
phelrine / filter.R
Created July 14, 2011 18:29
filter
normalize <- function(col) {
m <- col - mean(col)
v <- var(col)
if(v == 0){
return(m)
}else{
return(m/sqrt(v))
}
@phelrine
phelrine / hirakana.sh
Created August 30, 2011 18:01
漢字ひらがな変換
#!/bin/sh
mecab --node-format="%f[7] " | nkf -w --hiragana | sed 's/EOS//g'
@phelrine
phelrine / scap
Created October 15, 2011 11:38
screen capture
#!/bin/sh
# -*- mode: sh-mode; -*-
import `date +%Y-%m-%d-%H:%M:%S`.png
@phelrine
phelrine / transitional_icon.sh
Created October 18, 2011 03:57
移行アイコン作成
#!/bin/sh
new_icon=$1
old_icon=$2
composite_icon_name=$3
percentage=35
size=`identify $new_icon | cut -d' ' -f3 | cut -d'x' -f1`
resize_size=$(($size * $percentage / 100))
geometry=$(($size - $resize_size))