Skip to content

Instantly share code, notes, and snippets.

View cocuh's full-sized avatar
🛌
Comfy bed sleeping

cocuh cocuh

🛌
Comfy bed sleeping
View GitHub Profile
<html lang="ja">
<head>
<meta charset="utf-8"/>
<title>metaboll</title>
<script>
Metaboll = {
selected: null,
bolls: [],
threshold: 5
};
@cocuh
cocuh / index.svg
Last active August 29, 2015 13:56
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
globals().__setitem__('c',lambda x,y:globals().__setitem__(x,y))or c('sys',__import__('sys'))or c('os',__import__('os'))or sys.setrecursionlimit(10000)or c('u',"Usage: Ame.py FILE [DEBUG]")or c('DebugMode',0)or c('n',lambda:g(("""\n# WM:{WM}\n# LTM:{LTM}\n# ptr:{ptr} ptr_tmp:{len_ptr_tmp}:{ptr_tmp} depth:{source_depth}\n# tmp:{tmp} sourcelength:{len_sourcelist}\n""".format(WM=WM,LTM=LTM,tmp=tmp,len_sourcelist=len(sourcelist),sourcelist=sourcelist,ptr=ptr,len_ptr_tmp=len(ptr_tmp),source_depth=source_depth,ptr_tmp=ptr_tmp))if DebugMode else''))or c('r','')or c('sourcelist',[])or c('f','')or c('WM',[])or c('LTM',[])or c('ptr_tmp',[])or c('source_depth',0)or c('ptr',0)or c('tmp',0)or c('d',lambda y:c('tmp',y))or c('e',lambda x:c(x,globals()[x][1:]))or c('j',lambda x:c(x,[globals()[x][0]]+globals()[x][2:]))or c('g',lambda x:sys.stdout.write(x)and 0)or c('SyntaxError',lambda x:(g("SyntaxError:"+"\n".join([str(y)for y in[x,r,sourcelist]])+'\n')or sys.exit()))or c('q',lambda x,y=0:q(x[1:],y*3+{'/':0,'|':1,'.':2}[x[0
@cocuh
cocuh / index.py
Created March 8, 2014 04:43
勉強しながら書いたもの
# 奇数変換 16進数まで対応
# f(10,10) = '10'(10)
# f(10,8) = '12'(8)
# f(10,16) = 'A'(16)
f=lambda x,n,p='':x and f(x//n,n,'%X'%(x%n)+p)or p
@cocuh
cocuh / hoge.tex
Created March 19, 2014 12:28
まくろっぽいこと
\newcommand{\toggle}[2]{#1}
\newcommand{\eitem}[1][]{#1 - \toggle}
%\renewcommand{\toggle}[2]{#2}
\begin{document}
\eitem{first}{second}
\eitem[$\time$]{first}{second}
#include<stdio.h>
#define true 1
#define false 0
// gcc
int main(){
printf(true?true?"a":"b":"c"); // a
printf(true?false?"a":"b":"c"); // b
printf(false?true?"a":"b":"c"); // c
printf(false?false?"a":"b":"c"); // c
@cocuh
cocuh / pgm2pil.py
Created April 23, 2014 04:37
pgm file (only P1,P2,P3) convert to pil object
from PIL import Image
import re
class BadSize(BaseException):pass
class BadMode(BaseException):pass
class BadData(BaseException):pass
def _pgm_type_p1(image, data_iter):
width,height = image.size
pass
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# vim: fileencoding=utf-8
import freetype
face = freetype.Face('/usr/share/fonts/TTF/Koruri-Light.ttf')
face.set_char_size(48*64)
print(face.has_kerning)
# coding=utf-8
import xml.dom.minidom as minidom
import freetype
def gen_element(tag_name):
return minidom.Element(tag_name)