Skip to content

Instantly share code, notes, and snippets.

View kuno's full-sized avatar

kuno kuno

View GitHub Profile
@kuno
kuno / PKGBUILD
Created January 1, 2011 05:38
python-fabric 0.9.3 PKGBUILD
# Maintainer: James Pearson <james.m.pearson+arch@gmail.com>
pkgname=python-fabric
pkgver=0.9.3
pkgrel=1
pkgdesc="A Python library and command-line tool designed to streamline deploying applications or performing system administration tasks via the SSH protocol."
url="http://fabfile.org/"
license=('BSD')
arch=('any')
depends=('pycrypto' 'python2>=2.7' 'python-paramiko')
@kuno
kuno / exports.compareVersion
Created January 20, 2011 07:34
new compareVersion method
var notSmaller, arrayA = versionA.split('-'), arrayB = versionB.split('-'),
minorA, minorB, mainA = arrayA[0].split('.'), mainB = arrayB[0].split('.'),
len = (mainA.length <= mainB.length) ? mainA.length : mainB.length;
for (var i = 0; i < len; ++i) {
if (parseInt(mainA[i], 10) < parseInt(mainB[i], 10)) {
notSmaller = -1;
break;
} else if (parseInt(mainA[i], 10) > parseInt(mainB[i], 10)) {
notSmaller = 1;

Readline

To use this module, do require('readline').

rl.createInterface(input, output, completer)

Takes two streams and creates a readline interface. The completer function is used for autocompletion. When given a substring, it returns [substr, completedStr]. TODO: write some code to make sure I'm right.

createInterface is commonly used with process.stdin and process.stdout in order to accept user input:

#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
@kuno
kuno / PKGBUILD
Created April 17, 2011 10:42
nodejs based on official arch v8 package
# Maintainer: James Campos <james.r.campos@gmail.com>
# Contributor: BlackEagle < ike DOT devolder AT gmail DOT com >
# Contributor: Dongsheng Cai <dongsheng at moodle dot com>
# Contributor: Masutu Subric <masutu.arch at googlemail dot com>
# Contributor: TIanyi Cui <tianyicui@gmail.com>
pkgname=nodejs
pkgver=0.4.6
pkgrel=2
pkgdesc="Evented I/O for V8 javascript"
@kuno
kuno / PKGBUILD
Created April 26, 2011 04:09
alternative couchdb python driver
# Maintainer: Guan 'kuno' Qing <neokuno AT gmail DOT com>
pkgname=python2-couchdb-hg
_realname=couchdb-python
pkgver=20110426
pkgrel=1
pkgdesc="Python library for working with CouchDB, hg version."
url="http://code.google.com/p/couchdb-python/"
license=('BSD')
arch=(any)
@kuno
kuno / gist:947846
Created April 29, 2011 04:41 — forked from jb55/gist:945731
replace nginx with connect
var connect = require('connect')
, proxy = require('http-proxy')
function redirect(loc) {
return connect.createServer(function(req, res){
res.writeHead(301, { "Location": loc });
res.end();
});
}
@kuno
kuno / nodeconf_2011.md
Created May 6, 2011 23:51 — forked from guybrush/nodeconf_2011.md
a list of slides from nodeconf 2011
@kuno
kuno / npm-debub.log
Created July 25, 2011 00:09
npm-debub.log
info it worked if it ends with ok
verbose cli [ 'node', '/usr/bin/npm', 'install', '-g', 'geoip' ]
info using npm@1.0.20
info using node@v0.4.10
verbose config file /root/.npmrc
verbose config file /usr/etc/npmrc
silly exec /usr/bin/node "/usr/lib/node_modules/npm/bin/npm-get-uid-gid.js" "kuno" 0
silly output from getuid/gid {"uid":1000,"gid":0}
silly output from getuid/gid
verbose into /usr/lib [ 'geoip' ]