Skip to content

Instantly share code, notes, and snippets.

View bgnori's full-sized avatar

Noriyuki Hosaka bgnori

  • Itabashi, Tokyo, Japan
View GitHub Profile
#!/usr/bin/python
import os
import struct
ts = struct.unpack("L", os.urandom(8))
print(ts[0])
@bgnori
bgnori / solver.c
Created August 20, 2013 06:43
solver for a puzzle. gcc -std=c99 -Wall -o solver solver.c
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define HSIZE 3
#define VSIZE 3
#define SIZE 9
#define FACT9 362880
mc:
gcc -I/usr/local/include/python3.3m -shared -fPIC -std=c99 -Wall -o mc.so mc.c
#!/usr/bin/python
#
import sys
class Alchemey(object):
def __init__(self):
self.prices = {}
self.recipes = {}
(?:(?P<_hashtodo>#todo)(?:(?:(?: ))+(?:(?:(?P<_notimplemented>notimplemented(?:(?:(?: ))+(?:.*))?)|(?P<_about>about(?:(?:(?: ))+(?:.*))?)|(?P<_add>add(?:(?:(?: ))+(?:(?P<_add_description>.+))?)?)|(?P<_addto>addto(?:(?:(?: ))+(?:(?:(?P<_addto_nicknames140216808838224>[a-zA-Z@][a-zA-Z0-9_]*)(?:,))?(?:(?P<_addto_nicknames140216808838480>[a-zA-Z@][a-zA-Z0-9_]*)(?:,))?(?:(?P<_addto_nicknames140216808838672>[a-zA-Z@][a-zA-Z0-9_]*)(?:,))?(?:(?P<_addto_nicknames140216808838864>[a-zA-Z@][a-zA-Z0-9_]*)(?:,))?(?:(?P<_addto_too_many>(?P<_addto_too_many_nickname>[a-zA-Z@][a-zA-Z0-9_]*)(?:,)))*(?:(?P<_addto_nickname>[a-zA-Z@][a-zA-Z0-9_]*)(?:(?!,)))?)?)?(?:(?:(?: ))+(?:(?P<_addto_description>.+))?)?)|(?P<_help>help(?:(?:(?: ))+(?:(?P<_help_command>[a-z]+))?)?(?:(?:(?: ))+(?:.*))?)|(?P<_edit>edit(?:(?:(?: ))+(?:(?P<_edit_task_id>\d+))?)?(?:(?:(?: ))+(?:(?P<_edit_description>.+))?)?)|(?P<_debug>debug(?:(?:(?: ))+(?:(?P<_debug_task_id>\d+))?)?(?:(?:(?: ))+(?:.*))?)|(?P<_del>del(?:(?:(?: ))+(?:(?P<_del_task_ids140216808797072>
#!/usr/bin/python
def ujmcount(x, *xs):
if xs:
return ujmcount(*xs) + 1
else:
return 1
print ujmcount(*[1, 2, 3, 4, 5])
def f(n):
x = 1
for i in range(1, n+1):
x = x*i
while x % 10 == 0:
x = x / 10
x = (x % 100000)
#!/usr/bin/env python
import json
MONOOPS = '-'
LEFTOPS = "+-*/%"
QUOTE = 'quote'
IF = 'if'
LAMBDA = 'lambda'
#!/usr/bin/env python
from selenium import webdriver
PAGE = "file:///home/nori/Desktop/study/yamljs/hoge.html"
class Executor:
def __init__(self):
self.driver = driver = webdriver.PhantomJS('phantomjs')
self.driver.get(PAGE)
PyYAML==3.10
selenium==2.33.0