Skip to content

Instantly share code, notes, and snippets.

@ku
ku / README.md
Created February 26, 2012 09:20
xml to json converter; nodejs wrapper of xml2json.js
We couldn’t find that file to show.
@ku
ku / substr
Created February 26, 2012 08:32
#!/usr/bin/env php
<?php
if (count($argv) < 3) {
die("Usage: substr filename offset\n");
}
$name = $argv[1];
$offset = $argv[2];
$s = file_get_contents($name);
@ku
ku / nengapoke.js
Created February 25, 2012 20:53
nengapoke
var a=null;;$x("//ul/li//a/@data-profileid").filter(function (n) {return /*n.nodeValue == ""*/ true} ).map(function(n){
var profile_id = n.nodeValue;
if (a) document.body.removeChild(a)
a = document.createElement("a");
a.id = "pb-" + profile_id;
a.setAttribute("ajaxify", '/ajax/pokes/poke_inline.php?uid=' + profile_id + '&amp;name=dummy');
a.setAttribute("rel", "async-post");
a.appendChild( document.createTextNode("Poke"));
document.body.appendChild(a);
@ku
ku / gopen
Created February 17, 2012 22:23
open corresponding URL of the repository of current directory
#!/bin/sh
GIT='git'
if test `uname` = "Darwin" ; then
SED_OPT='-E'
OPEN='open'
else
SED_OPT='-r'
OPEN=''
#!/usr/bin/env coffee
http = require 'http'
https = require 'https'
zlib = require 'zlib'
cookieStore = {}
uuid = 'x'
appleid = '[email protected]'
@ku
ku / gist:1392790
Created November 25, 2011 04:12
json to plist
#import <Foundation/Foundation.h>
int main(int ac, char* av[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSError *e;
if (ac < 2) {
printf("need json file.\n");
return -1;
=urwid=
*passing argument 3 of ‘PyString_AsStringAndSize’ from incompatible pointer type
modify some lines
int pos, text_len; -> Py_ssize_t text_len;
*/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
env ARCHFLAGS="-arch i386 -arch x86_64" python setup.py install
env ARCHFLAGS="-arch i386 -arch x86_64" http://stackoverflow.com/questions/5256397/python-easy-install-fails-with-assembler-for-architecture-ppc-not-installed-on