Skip to content

Instantly share code, notes, and snippets.

View shomah4a's full-sized avatar

shoma shomah4a

  • 12:48 (UTC +09:00)
View GitHub Profile
@shomah4a
shomah4a / sexp.ebnf
Created November 19, 2011 06:56
なんかこんなんで S 式パースできた
IGNORE: " ";
INTEGER: "0|[1-9][0-9]*";
FLOAT: "(0|[1-9][0-9]*)\.[0-9]*";
SYMBOL: "[a-zA-Z_-][a-zA-Z0-9_-]*";
STRING: "\"[^\\"]*\"";
sexpr: SYMBOL | INTEGER | FLOAT | STRING | list;
list: "(" sexpr* ("." sexpr)? ")";
@shomah4a
shomah4a / caseclass.py
Created November 21, 2011 11:27
こんなん?
#-*- coding:utf-8 -*-
class CaseClassLike(object):
def __init__(self, **argd):
self.__dict__.update(argd)
@shomah4a
shomah4a / StaticClass.java
Created December 8, 2011 07:16
import の挙動とか
package aaaaa;
public class StaticClass
{
public static String someValue = null;
public static void updateSomeValue(String value)
{
someValue = value;
}
@shomah4a
shomah4a / gist:1501845
Created December 20, 2011 14:58
thread + print
#-*- coding:utf-8 -*-
import time
from pypy.module.thread import ll_thread
def add(x, y):
return x + y
@shomah4a
shomah4a / listiter.py
Created January 5, 2012 15:35
list の iterator ってようはこんなもん?
class ListIter(object):
def __init__(self, target):
self.target = target
self.index = 0
@shomah4a
shomah4a / test.py
Created January 14, 2012 02:05
エラーになるね
def main(args):
a = []
a.append(10)
a.append([10])
return 0
@shomah4a
shomah4a / .xmobarrc
Created January 18, 2012 01:20
xmonad confs
Config { font = "xft:Sans-9:bold",
bgColor = "black",
fgColor = "grey",
position = TopW L 80,
lowerOnStart = False,
commands = [
Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10,
Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10,
Run Memory ["-t","Mem: <usedratio>%"] 10,
Run Swap [] 10,
@shomah4a
shomah4a / mrotest.cpp
Created January 19, 2012 08:13
メソッド解決できねーぞこの野郎エラー
#include <iostream>
class A
{
virtual void test(void) const
{
std::cout << "class A" << std::endl;
}
@shomah4a
shomah4a / advice.el
Created January 23, 2012 03:25
結局これで落ち着いた
;; compilation-start をゴニョる
(defadvice compilation-start (before compilation-start-before (command &optional mode name-function highlight-regexp))
(if (null name-function)
(setq name-function
(lambda (name)
(concat "*"
name
" \""
command
@shomah4a
shomah4a / comparing-partial-evaluation-and.rst
Created January 27, 2012 00:10
Comparing Partial Evaluation and Tracing, Part 1