Skip to content

Instantly share code, notes, and snippets.

@utgwkk
utgwkk / bf.rb
Last active May 24, 2016 08:57
Brainf*ck
# coding: utf-8
# bf.rb
# 入力された文字列を出力する Brainf*ck コードを出力する
def f(num)
if num <= 13 then
return false
end
lst = []
cnt = 0
@utgwkk
utgwkk / misaToBF.perl
Created July 26, 2015 03:31
Misa→BFコンバートするのほおぉぉぉぉおおぉおおぉぉぉぉっっ☆
#!/usr/bin/perl
use utf8;
sub misaToBF {
$_[0] =~ tr/→~ー←★☆あぁおぉっッ!!??「『」』/>>><<<\+\+\+\+\-\-\.\.,,\[\[\]\]/;
$_[0] =~ s/[^><\+\-\.,\[\]]//g;
return $_[0];
}
my $text = <<"EOF";
ごっ、ごぉおっ、ご~きげんよおぉおおぉおほっ。ほおぉおぉおっ。
@utgwkk
utgwkk / ray-ban-detector.py
Last active August 29, 2015 14:25
レイバン検出するやつ
# -*- coding: utf-8 -*-
# NOTE: use Python 3.
import tweepy
import re
import sys
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
me = 'YOUR_SCREEN_NAME'
import pygame, sys, random
from copy import deepcopy
pygame.init()
size = (800,450)
white = (255, 255, 255)
color = (30, 30, 180)
fps = 30
screen = pygame.display.set_mode(size)
pygame.display.set_caption('lifegame')
# coding: utf-8
import os
from PIL import Image
from glob import glob
flist = []
fhist = []
dl = []
dirname = './images/'
import tempfile
import sqlite3
import webbrowser
if __name__ == '__main__':
conn = sqlite3.connect('hoge.db')
c = conn.cursor()
tmp = tempfile.mkstemp(prefix='pythontemp_', suffix='.htm')
f = open(tmp[1], 'wt')
b = ''
# coding: utf-8
import os
import hashlib
from glob import glob
flist = []
fmd5 = []
dl = []
dirname = './images/'
@utgwkk
utgwkk / lifegame.py
Last active August 29, 2015 13:57
A Lifegame for Python (requires Pygame)
import pygame, sys, random
from copy import deepcopy
pygame.init()
size = (800,450)
white = (255, 255, 255)
color = (30, 30, 180)
fps = 30
screen = pygame.display.set_mode(size)
pygame.display.set_caption('lifegame')
import System.Net
import System.Text
import System.IO
url as string = 'https://www.google.co.jp/'
enc as Encoding = Encoding.GetEncoding('UTF-8')
req as WebRequest = WebRequest.Create(url)
res as WebResponse = req.GetResponse()
st as Stream = res.GetResponseStream()
sr as StreamReader = StreamReader(st, enc)
#!/usr/bin/env python
# coding: utf-8
from google.appengine.api import images
from google.appengine.ext.webapp import template
import webapp2 as webapp
import os
from StringIO import StringIO
try: from PIL import Image
except ImportError: import Image