Skip to content

Instantly share code, notes, and snippets.

View Kami's full-sized avatar
:octocat:
🐕‍🦺 🦮 🇸🇮 🇺🇦 🇹🇼

Tomaz Muraus Kami

:octocat:
🐕‍🦺 🦮 🇸🇮 🇺🇦 🇹🇼
View GitHub Profile
@Kami
Kami / gist:676264
Created November 15, 2010 00:31
nodejs c++ function
static Handle<Value> GetPwUid(const Arguments& args) {
HandleScope scope;
if (args.Length() < 1) {
return ThrowException(Exception::Error(
String::New("getpwuid requires 1 argument")));
}
int uid;
static int CallGetPwUidNam(eio_req *req) {
struct getpw_request *greq = (struct getpw_request *)req->data;
size_t bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
if (bufsize == -1) {
bufsize = 1024;
}
greq->buffer = (char *)malloc(bufsize);
if (!greq->buffer) {
var http = require('http');
var assert = require('assert');
var http_server = http.createServer(function(request, response) {
response.writeHead(200, {'Content-Type': 'text-plain'});
response.end('');
}).listen(8081, '127.0.0.1', done);
function done() {
var client = http.createClient(8081, 'localhost', true);
exports['PUT [email protected]'] = function(assert, beforeExit) {
var n = 0;
ps.on('bundles listed', function() {
var req = {
url: '/bundles/bar/[email protected]',
method: 'PUT',
headers: {
'Transfer-Encoding': 'chunked'
},
streamer: function(request) {
@Kami
Kami / app
Created December 4, 2010 01:57
service
import os
from twisted.application import service, internet
from twisted.names import dns
from twisted.names import server
from names_test import TestResolver
import names_test
We couldn’t find that file to show.
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>
Traceback (most recent call last):
File "/usr/lib/python2.6/threading.py", line 504, in __bootstrap
self.__bootstrap_inner()
File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
File "/usr/lib/python2.6/threading.py", line 484, in run
self.__target(*self.__args, **self.__kwargs)
--- <exception caught here> ---
File "/home/kami/virtualenvs/xxxxxx/lib/python2.6/site-packages/twisted/python/threadpool.py", line 210, in _worker
result = context.call(ctx, function, *args, **kwargs)
@Kami
Kami / gist:818383
Created February 9, 2011 12:21
PyPy benchmark example code
import sys
import time
import waxeye
from ckparser import Parser
p = Parser()
queries = [
# Simple queries
@Kami
Kami / gist:818385
Created February 9, 2011 12:22
Waxeye carser code
# Generated by the Waxeye Parser Generator - version 0.7.0
# www.waxeye.org
from waxeye import Edge, State, FA, WaxeyeParser
class Parser (WaxeyeParser):
start = 0
eof_check = True
automata = [FA("query", [State([Edge(16, 1, False)], False),
State([Edge(1, 2, False)], False),