Skip to content

Instantly share code, notes, and snippets.

@smeghead
smeghead / search_missing_modules.pl
Created May 20, 2011 09:46
search missing modules script.
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
print "#-- missing modules list --\n";
while (<DATA>) {
eval("use $_;");
if ($@) {
print "cpanm $_";
@smeghead
smeghead / unity-gsettings.sh
Created June 1, 2011 07:30
Unity systray-whitelist setting.
gsettings set com.canonical.Unity.Panel systray-whitelist "['JavaEmbeddedFrame', 'Mumble', 'Wine', 'Skype', 'hp-systray', 'scp-dbus-service', 'Dropbox', 'check-git-status', 'SWT']"
@smeghead
smeghead / AnyEvent-Groonga_filter-support.patch
Created June 8, 2011 05:15
AnyEvent-Groonga filter-support patch
diff --git a/lib/AnyEvent/Groonga.pm b/lib/AnyEvent/Groonga.pm
index fcf0a4c..2e2ded1 100644
--- a/lib/AnyEvent/Groonga.pm
+++ b/lib/AnyEvent/Groonga.pm
@@ -221,7 +221,7 @@ sub _generate_groonga_command {
if ( $command eq 'load' && $key eq 'values' ) {
$value = $self->_load_filter($value);
}
- elsif ( $command eq 'select' && $key eq 'query' ) {
+ elsif ( $command eq 'select' && ( $key eq 'query' || $key eq 'filter' )) {
@smeghead
smeghead / .screenrc
Created June 17, 2011 00:51
screen settings
escape ^z^z
startup_message off
autodetach on
hardstatus on
hardstatus alwayslastline "screen |%c %m/%d | %w"
@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;
}
@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 / 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 / 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 / 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)))
(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