Skip to content

Instantly share code, notes, and snippets.

@miku
miku / error.txt
Created March 11, 2014 18:07
Delete graph
40005SR325: Transaction aborted because it's log after image size went above the limit in v:vscx "navbar1" (render)
@miku
miku / fibgen.py
Last active August 29, 2015 13:57
def fib(k=100):
""" Generate fibonacci numbers up to k. """
a, b = 1, 2
while a <= k:
yield a
a, b = b, a + b
print(' '.join(map(str, fib())))
# prints: '1 2 3 5 8 13 21 34 55 89'
@miku
miku / gnddist.txt
Created March 12, 2014 14:59
GND class distribution.
4664636 gndo:UndifferentiatedPerson
3004361 gndo:DifferentiatedPerson
1050960 gndo:CorporateBody
549500 gndo:ConferenceOrEvent
127003 gndo:TerritorialCorporateBodyOrAdministrativeUnit
113128 gndo:MusicalWork
111543 gndo:SubjectHeading
90505 gndo:OrganOfCorporateBody
78204 gndo:Work
61032 gndo:PlaceOrGeographicName
# coding: utf-8
"""
Intervals for luigi.DateParameter.
Usage:
# run this on the 1st of every month ...
date = luigi.DateParameter(date=intervals.monthly())
@miku
miku / reactjs.js
Created March 26, 2014 09:21 — forked from pk11/reactjs.js
/** @jsx React.DOM */
/**
* Our component structure will look like the following:
* - WikiBox
* -- AutoCompleteBox
* --- AutoComplete
*/
// this component renders a single entity coming from wikipedia
@miku
miku / 2048.c
Created April 5, 2014 12:44 — forked from justecorruptio/2048.c
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@miku
miku / attrattr.py
Created April 8, 2014 17:37
Attr-Attr.
# coding: utf-8
def adj(g):
"""
Convert a directed graph to an adjacency matrix.
Note: The distance from a node to itself is 0 and distance from a node to
an unconnected node is defined to be infinite.
>>> g = {1: {2: 3, 3: 8, 5: -4},