Skip to content

Instantly share code, notes, and snippets.

@cou929
cou929 / gist:524320
Created August 14, 2010 14:01
.emacs
;;;; .emacs
;;; add ~/elisp/ to load-path
(setq load-path
(append
(list
(expand-file-name "~/.emacs.d/elisp")
(expand-file-name "/usr/share/emacs/site-lisp/w3m")
)
load-path))
@cou929
cou929 / gist:524328
Created August 14, 2010 14:08
.screenrc
## エスケープキーの設定
escape ^Tt
## ビジュアルベルを無効
vbell off
## ステータス行の設定
hardstatus alwayslastline "[%02c] %`%-w%{=b bw}%n %t%{-}%+w"
## スタートアップ時メッセージ無効
@cou929
cou929 / gist:524332
Created August 14, 2010 14:12
TopCoder CodeProcessor Template (C++)
$BEGINCUT$
$ENDCUT$
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
@cou929
cou929 / buildxpi.sh
Created August 14, 2010 13:19
A naive script to build a firefox extension xpi file.
#!/bin/sh
##
## Kosei Moriyama <cou929@gmail.com>
##
## Very naive script to build a firefox extension xpi file.
##
## Before you use this script, you should prepare chrome.manifest
## which supports the case that files in the chrome directory are
## compressed as .jar file.
@cou929
cou929 / gist:524326
Created August 14, 2010 14:06
.zshrc
## zsh confs
## via http://bloghackers.net/~naoya/webdb40/
# auto complete
autoload -U compinit
compinit
# command history
HISTFILE=$HOME/.zsh-history
HISTSIZE=10000000
/**
* toru.js
* Kosei Moriyama <cou929@gmail.com>
*
* Get selection area, traverse the area, obtain xpath of dom elements inside the area
* and send the xpath to torerundesu server.
*
* TODO:
* - Find cookies and check the user is logined or not.
* - Send results to the server.
@cou929
cou929 / scrape.js
Created September 20, 2010 15:50
Code snippet to scrape web site using jquery.
/**
* scrape.js
* Code snippet to scrape web site using jquery.
* This code is from WEB+DB Press Vol.51 JavaScript 今ドキ活用術 by Shinichi Tomita
*/
jQuery.noConflict();
(function($) {
jQuery.fn.scrape = function(def) {
// get text value from DOM node
A = [5, 2, 4, 6, 1, 3]
for j in range(1, len(A)):
key = A[j]
i = j - 1
while i >= 0 and A[i] > key:
A[i+1] = A[i]
i -= 1
A[i+1] = key
@cou929
cou929 / template.pl
Created October 10, 2010 02:49
Template for perl script.
#! /usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use Pod::Usage;
my $man = 0;
my $help = 0;
# my $port = 0;
@cou929
cou929 / bootpl.pl
Created January 4, 2011 15:57
Generate template of perl script
#! /usr/bin/perl
use strict;
use warnings;
&main; exit;
sub main {
if (!$ARGV[0]) {
print "Usage: $0 <script name>\n";