Skip to content

Instantly share code, notes, and snippets.

@catupper
catupper / sudden_death.py
Created October 7, 2012 12:20 — forked from hiromu/sudden_death.py
Test for using Twitter Streaming API
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import tweepy
import json
import pymongo
db_host = 'localhost'
db_port = 27017
# -*- coding: utf-8 -*-
import sys
import tweepy
import json
import pymongo
con = pymongo.Connection(host = ,port = )
username = ""
password = ""
# -*- coding: utf-8 -*-
import sys
import tweepy
import json
import pymongo
con = pymongo.Connection(host='',port='')
db = con.death
@catupper
catupper / dictionary.txt
Created September 20, 2012 11:22
wordhere solver dictionary
This file has been truncated, but you can view the full file.
aaa
aachen
aah
aahed
aahing
aahs
aal
aalborg
aalii
aaliis
#include<stdio.h>
#include<stdlib.h>
typedef int it; //various type
struct stack_s{
it x;
struct stack_s * before;
struct stack_s * next;
};
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygame
from pygame.locals import *
from random import randint as rr
pygame.init()
NORMAL_FONT="normal_font_file_path"
NUMBER_FONT="number_font_file_path"
@catupper
catupper / word_hero_cheat.py
Created September 6, 2012 11:27
cheat program of word hero
Dictfile="Dictionary_path"
f=open(Dictfile,"r")
p=[]
LEN=0
for line in f:
line=line.strip()
if len(line)<3:continue
p+=[line]
LEN+=1
とある保育園は1組からn組までクラスが存在してある。ただしn>1においてn組が存在すればn-1組も存在するとする。
このときすべての組から一人以上幼女を連れてきた結果5人の幼女が集まった。
ここで私は彼女らの記憶を操作し、自分が何組かわからないようにした。
そのかわり自分以外の幼女が何組なのかという事は一目見てわかるようにした。
そして5人の幼女に向きと場所を与え、これから毎日その向き、場所で一直線に無言で並ばせることにした。
この時自分の向いてる方向にいる幼女の組はわかることになる。
もし、自分の組がわかったらそれを口にせず、次の日から来なくて良いというルールにした。
このようなルールで5人を並ばせると、
一日目には5人いて
二日目には4人になり
@catupper
catupper / nazoki.py
Created August 29, 2012 01:27
Nazotree in python
from math import sqrt
def upsqrt(x):
k=sqrt(x)
res=1
while res<k:res<<=1
return res
def botsqrt(x):
k=sqrt(x)
import Image
import ImageDraw
import ImageChops
HEIGHT=500 #0.0-1.0
WIDTH=1000 #2.0-4.0
red=(255,0,0)
whtle=(255,255,255)
zahyo = Image.new("RGB",(WIDTH+15,HEIGHT+15),white)