This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aliases for git | |
alias g="git" | |
alias gad="git add" | |
alias gb="git branch -v" | |
alias gba="git branch -a" | |
alias gbl="git blame" | |
alias gbr="git branch -r" | |
alias gc="git commit -v" | |
alias gca="git commit -av" | |
alias gco="git checkout" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<title>CSRF test</title> | |
</head> | |
<body onload="document.getElementById('f').submit();"> | |
<form action="/some/post/url" method="post" id="f" target="ifr"> | |
<input type="text" name="body" value="CSRF!" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
def say(word=None): | |
print word | |
if __name__ == '__main__': | |
say(word='hi') | |
say(**{'word': 'hi'}) | |
say(**{'wo'+'rd': 'hi'}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
commit = ARGV.empty? ? 'HEAD' : ARGV.shift | |
puts `git log --pretty=oneline #{commit}`.split(/\s+/)[0] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
def fact(x): | |
def factrec(f, n): | |
if n < 1: | |
return 1 | |
else: | |
return n * (f (f, (n - 1))) | |
return factrec(factrec, x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# http://ameblo.jp/programming/entry-10001721422.html | |
class Cards: | |
@classmethod | |
def deal(cls, num, string): | |
cds = [""]*num | |
for i in xrange(len(string) / num): | |
for j in xrange(num): | |
cds[j] += string[i*num+j] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Hash::MultiValue; | |
use XXX; | |
my $h = [a => 1, a => 2, b => 3]; | |
my $hm = Hash::MultiValue->new(@$h); | |
YYY $hm; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package HTTP::RequestHandler::GET; | |
use base qw/HTTP::RequestHandler/; | |
use strict; | |
use warnings; | |
sub handle_request { | |
my ($self, $request) = @_; | |
return if $request->method ne 'GET'; | |
warn 'Requested method is GET: ' . $request->uri; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use WWW::Mechanize; | |
use Config::Pit; | |
my $mech = WWW::Mechanize->new(); | |
my $login_url = "http://lang-8.com/login"; | |
my $response = $mech->get($login_url); | |
my ( $mail, $password ) = do { @{ pit_get("lang-8.com") }{qw/mail password/} }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun c++-debug-print() | |
(interactive) | |
(let* ((var-str (read-from-minibuffer "variables (space separated): ")) | |
(vars (split-string var-str)) | |
(dp "cout")) | |
(dolist (v vars) | |
(setq dp (concat dp " << " v " << \", \""))) | |
(insert (concat dp " << endl;")))) |