Skip to content

Instantly share code, notes, and snippets.

Avatar

Shotaro Kohama shotarok

View GitHub Profile
@shotarok
shotarok / fout-quine.pl
Last active Nov 3, 2015
Quine shaped FreakOut Inc. logo.
View fout-quine.pl
$_=q{"9
zzw9stffwzjrb lzoop5x6l3xj98
rez0uehk014cs4uh72p qdhq6 o039t
pk94 zyj09rr vc4j vl4c2
0dwm4 x8c t9b wbjz
ux6w3 jc4 8t iqqv
l3gpc nd5 6t2 i2nq
xsvcy uu13 td1o 9n11j1654d7u6l6l
n1v539 f 6c7dp7k xpbxlyx7eri3wq1vk9 w
uttvi8j6qw4i68gjmdg5g3 65uw34rcvs3ldt0ue
@shotarok
shotarok / fout-quine.rb
Last active Nov 3, 2015
Quine of FreakOut Inc Logo
View fout-quine.rb
eval$s=
%w(s=%(eval$s =%w(#{$s})*"")
;base36encoded="gz7 v8c1f y6azn
l8vi pq3i129 l1lk yb6dj
3385g 95h mxb cg2f
aabtk tns yp d5a9
rqs1g ov8 dey awff
43r1a n6e0 7joo fgirz1eu3ol09r2a
43rln0 r 3n2rox3 ravoonncbxvwpddgo4 y
3vdmopycm4m1fpwltuir1l 8xk472nv87wg6uw0q
View multi_vectorizer.py
#! /usr/bin/env python
# -*- coding:utf-8 -*-
import concurrent.futures
import sys
import subprocess
import time
from collections import defaultdict
from data import sentences
View Compiler Output
[info] Running jp.ac.kyotou.kansai.fickleAI
func_entryPoint:
LDC 0
LDC 0
LDC 0
LDC 0
LDF body_entryPoint
TAP 4
body_entryPoint:
LDC 0
View sample.gcc
LDC 0 ;; initial AI state
LDF 4 ;; Step Function
CONS ;; (init state, step func)
RTN
LDC 0 ;; Current AI state
LDC 1 :: AI direction move {0: up, 1: right, 2: down, 3: left}
CONS ;; (current state, move)
RTN
View random_walk.gcc
LDC 8 ; seed number
LDF 4 ; step function
CONS
RTN
LD 0 0 ; load current AI state
LDC 1664525 ; A for 19
LDC 69069 ; B for 19
LDC 10000003; M for 19
LDF 19
AP 4
View LCGs.gcc
LDC 8 ; now
LDC 3 ; A
LDC 5 ; B
LDC 13 ; M
LDF LCGs
AP 4
LDC 3 ; A
LDC 5 ; B
LDC 13 ; M
LDF LCGs
View ulam_spiral.cpp
#include <iostream>
#include <cstring>
using namespace std;
const int N = 30;
const int LENGTH = 2*N+1;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, -1, 0, 1};
@shotarok
shotarok / myflatten
Created Jun 30, 2013
My flatten function !!
View myflatten
def myflatten(ary)
tmp = []
ary.each { |e|
if e.is_a? Array then
tmp.concat myflatten(e)
else
tmp.push e
end
}
return tmp
@shotarok
shotarok / gist:5367231
Last active Dec 16, 2015
Quick sort where space order is O(1)
View gist:5367231
# coding: utf-8
import random
def quick_sort(inlist, first, last):
if last - first < 1:
return inlist
pivot = inlist[first]
left, right = first, last
while left != right:
if inlist[right] >= pivot: