Skip to content

Instantly share code, notes, and snippets.

@hktechn0
hktechn0 / kobo.sh
Created May 14, 2013 14:31
Convert PDF ebook for Kobo Touch
#!/bin/bash
##### SETTINGS #####
WIDTH=600
HEIGHT=750
OUTDIR="./cbz"
OUTFILE="${1}.cbz"
####################
@hktechn0
hktechn0 / json_benchmark.py
Created January 8, 2013 18:52
json serialize benchmark on python
import time
import random
import uuid
import json
import simplejson
import cjson
import czjson
import jsonlib
import jsonlib2
@hktechn0
hktechn0 / bspline.as
Created November 5, 2012 12:05
B-Spline Curves
package
{
import flash.display.Sprite;
import flash.geom.Point;
public class BSpline extends Sprite
{
private var points : Array;
public function BSpline()
@hktechn0
hktechn0 / pyconjp2012_redbull.py
Created September 16, 2012 18:00
PyCon JP 2012 Get RedBull Challenge
import sys
from HTMLParser import HTMLParser
value = dict()
class MyHTMLParser(HTMLParser):
isuser = False
def handle_starttag(self, tag, attrs):
if tag == "p" and dict(attrs).get("class", None) == "user":
#!/bin/sh
ld-mist32 -Tdata=0x0400 -Ttext=0x0000 -o reloc.o $1
objcopy-mist32 -j .text -O binary reloc.o text.bin
objcopy-mist32 -j .data -O binary reloc.o data.bin
od -t xC -w4 -v text.bin | cut -s -d ' ' -f 2- | sed -e 's/ //g' > text.hex
od -t xC -w4 -v data.bin | cut -s -d ' ' -f 2- | sed -e 's/ //g' > data.hex
echo "=== .text"
python verilog_out_text.py < text.hex
echo "=== .data"
@hktechn0
hktechn0 / vmlinux-3.2.0-1-amd64.disassemble.intel.instructions
Created February 9, 2012 18:10
Intel x86(amd64) instructions list in Linux kernel
# cat vmlinux-3.2.0-1-amd64.disassemble.intel| cut -f 3 -s | cut -d ' ' -f 1 -s | sort | uniq -c | sort -r
355290 mov
81309 call
55402 pop
51115 test
49871 push
46412 cmp
43782 je
38031 jmp
@hktechn0
hktechn0 / vmlinux-3.2.0-0.bpo.1-powerpc64.disassemble.instructions
Created February 9, 2012 18:04
PowerPC instructions list in Linux kernel
# cat vmlinux-3.2.0-0.bpo.1-powerpc64.disassemble | cut -f 3 -s | cut -d ' ' -f 1 | sort | uniq -c | sort -r
288840 ld
132620 std
111105 mr
97117 li
77279 bl
76090 addi
63505 nop
53079 beq-
@hktechn0
hktechn0 / bitly.py
Created November 28, 2011 05:37
bit.ly API wrapper for Python
#-*- coding: utf-8 -*-
import urllib
import urllib2
import json
class Bitly(object):
apihost = "http://api.bitly.com/"
login = "<your_login>"
apikey = "<your_apikey>"
@hktechn0
hktechn0 / twitpic.py
Created November 28, 2011 05:37
Twitpic v2 API wrapper for Python
#-*- coding: utf-8 -*-
# Twitpic API v2 wrapper methods
import httplib
import json
import email.mime.image
import email.mime.multipart
import email.mime.text
import email.encoders
@hktechn0
hktechn0 / twitpic-sync.py
Created December 11, 2010 13:18
Twitpic HTML Parser
#/usr/bin/env python
#-*- encode: utf-8 -*-
import HTMLParser
import urllib2
import time
class TwitpicParser(HTMLParser.HTMLParser):
baseurl = "http://twitpic.com/photos/"