Skip to content

Instantly share code, notes, and snippets.

@smeghead
smeghead / gist:2651925
Created May 10, 2012 08:41
一括置換
find . -name '*.ext' | xargs -n 1 perl -pi.bak -e 's/before string/after string/'
@smeghead
smeghead / rename.sh
Created April 25, 2012 07:59
拡張子の変更
for f in *.php; do n=${f%.*}; mv $n.php $n.tx; done;
@smeghead
smeghead / ja.po
Created April 20, 2012 14:50
Locale::Maketext::Simpleが動かない
msgid "hello"
msgstr "konnnitiwa"
@smeghead
smeghead / sslcert-check
Created November 10, 2011 01:01
check ssl cert expire.
#!/bin/sh
if [ $# == 0 ]; then
echo "usage: $1 <ssl cert file>"
exit 1
fi
FILENAME=$1
if [ ! -f "$FILENAME" ]; then
echo "ERROR: <ssl cert file> not exists. $FILENAME"
exit 1
(defn fib [n]
(cond
(< n 0) (throw (IllegalArgumentException. "fib argument must be plus number."))
(= n 1) 1
(= n 2) 1
:else (+ (fib (- n 2)) (fib (- n 1)))))
(loop [x 1]
(if (< x 10)
(do
@smeghead
smeghead / sample.clj
Created October 1, 2011 15:37
sample
(defn hogehoge [x]
(let [x 0
y 0]
hoge)
(fn [x 0
y 0]
(+ x y)))
@smeghead
smeghead / default
Created August 26, 2011 01:41
apache killer killer
# for Apache Killer. ignore Range Header.
RewriteEngine on
RewriteCond %{HTTP:range} !(^bytes=[^,]+(,[^,]+){0,4}$|^$)
RewriteRule .* - [F]
@smeghead
smeghead / perl.vim
Created July 27, 2011 09:58
perltidy on vim
map ,ptv <Esc>:'<,'>! LANG=C perltidy<CR>
map ,pt <Esc>:%! LANG=C perltidy<CR>
@smeghead
smeghead / dump_schema_mysql.pl
Created July 20, 2011 06:31
dump mysql tables column definitions.
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
sub options {
die "usage: $0 <user> <password> <host> <database>\n" if scalar(@ARGV) != 4;
return {
user => $ARGV[0],
@smeghead
smeghead / ranking.awk
Created June 25, 2011 19:07
referer samary
#!/usr/bin/awk -f
BEGIN {
}
{
if ($11 != "\"-\"") {
if (urls[$11] == "") {
urls[$11] = 0;
}
urls[$11] += 1;
}