Skip to content

Instantly share code, notes, and snippets.

View koko1000ban's full-sized avatar
🏠
Working from home

たびと koko1000ban

🏠
Working from home
View GitHub Profile
find . -name \*.php | xargs nkf --guess | perl -pe "s/.+://" | sort | uniq -c
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#まーじゃんのやつ
#http://www.itmedia.co.jp/enterprise/articles/1004/03/news002.html
class Hai
DEBUG = false
def initialize(s)
@table = build_table(s)
end
@koko1000ban
koko1000ban / fucknsysad-challenge.rb
Created November 24, 2010 06:02
arc challengeのまがいもの
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#arc challengeのまがいもの
require 'rubygems'
require 'sinatra'
require 'haml'
get '/' do
haml(:index)
@koko1000ban
koko1000ban / arch-gcc-code-assist
Created December 3, 2010 06:55
gcc-code-assist configure options
#uname -a
#Linux hoge 2.6.36-ARCH #1 SMP PREEMPT Wed Nov 24 00:39:57 CET 2010 x86_64 Intel(R) Core(TM)2 Duo CPU E4500 @ 2.20GHz GenuineIntel GNU/Linux
C_INCLUDE_PATH=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/include \
C_PLUS_INCLUDE_PATH=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/include \
LIBRARY_PATH=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.1 \
./configure --program-suffix=-code-assist --enable-languages=c,c++ --disable-bootstrap \
--disable-multilib --libdir=/usr/lib/gcc-code-assist --libexecdir=/usr/lib/gcc-code-assist \
--datadir=/usr/share/gcc-code-assist --infodir=/usr/share/info/gcc-code-assist \
--mandir=/usr/share/man/gcc-code-assist --with-gmp-include=/usr/include --with-gmp-lib=/usr/lib \
@koko1000ban
koko1000ban / gist:1027429
Created June 15, 2011 16:09
build pch-header and use it with clang-completion on osx10.6.7 clang(tags/Apple/clang-139)
build cxx pch-header
% clang -cc1 -triple x86_64-apple-darwin10 -emit-pch -disable-free -disable-llvm-verifier -main-file-name pchheader.h \
-pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 123.2 \
-resource-dir /Developer/usr/bin/../lib/clang/2.0 -ferror-limit 19 -fmessage-length 171 -stack-protector 1 \
-fblocks -fdiagnostics-show-option -fcolor-diagnostics -o /path/to/pchheader-nu.pch -x c++-header /path/to/pchheader.h
use it
% clang -cc1 -triple x86_64-apple-darwin10 -emit-pch -disable-free -disable-llvm-verifier -pic-level 1 -mdisable-fp-elim \
-masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 123.2 -resource-dir /Developer/usr/bin/../lib/clang/2.0 \
-ferror-limit 19 -fmessage-length 171 -stack-protector 1 -fblocks -fdiagnostics-show-option -fcolor-diagnostics -fsyntax-only \
@koko1000ban
koko1000ban / gist:1604106
Created January 13, 2012 01:13
sleepyti.me fake cui
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#fake http://sleepyti.me/
if ARGV.size == 0
warn "usage: #{$0} <ex. 7:20am>"
exit
end
@koko1000ban
koko1000ban / test_area_getter.rb
Created February 15, 2012 01:43
test_area_getter
module Ekispert
# よく考えると地域だからインスタンス化されるような使い方はないか..
module Area
LIST = [{ :name => :japan, :yomi => "全国", :code => 111 ..}, ..]
# クラスメソッドのかきかたわすれた..
module_function
def find(&block)
# クロージャで取捨選択
end
@koko1000ban
koko1000ban / nintendoooo5.rb
Created February 21, 2012 08:58
nintendooooo
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
A = [100, '*', 20, '+', 29, '+', 10, '*', 20, '+', 1, '*', 3, '+', 1, '+', 3, '*', 2]
ANS=7005
N = A.size
def rep(i, j, a)
a.insert(i, '(')
@koko1000ban
koko1000ban / next_permutation.rs
Created March 21, 2012 07:54
Rust implementaion for next_permutation
use std;
import core::option::{some, none};
import core::option;
fn next_permutation<T: copy>(v : [T]) -> option<[T]> {
let n = vec::len(v) as int;
let nv = vec::to_mut(v);
if n < 2 {
ret none;
}
@koko1000ban
koko1000ban / template.rs
Created April 5, 2012 14:45
template for google codejam with Rust
use std;
import core::io;
import io::reader;
import io::reader_util;
import std::sort;
impl read_util for reader{
fn read_valid_char() -> char {
let mut c;