Skip to content

Instantly share code, notes, and snippets.

View niedbalski's full-sized avatar
Be humble and stay focused

Jorge Niedbalski niedbalski

Be humble and stay focused
View GitHub Profile
@niedbalski
niedbalski / queue.xml
Created June 1, 2012 20:27
zmq_queue configuration
<queue>
<in>
<bind addr="tcp://127.0.0.1:5555"/>
</in>
<out>
<bind addr="tcp://127.0.0.1:5556"/>
</out>
</queue>
@niedbalski
niedbalski / extend.js
Created October 1, 2012 19:13
Object extend
Object.prototype.extend = function(source, destination) {
for(var property in source) {
destination[property] = source[property]
}
return destination;
}
@niedbalski
niedbalski / nosetests.xslt
Created October 2, 2012 19:42
python nosetests xslt for xunit report
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">]]></xsl:text>
<html>
<head>
<title>
Xunit Test Results - For: <xsl:value-of select="@name"/>
</title>
@niedbalski
niedbalski / anonymous recursive.js
Created October 9, 2012 19:06
Javascript self recursion on anonymous functions
(function(n) { return (!(n>1))? 1 : arguments.callee(n-1)*n; })(0xb4dc0d3);
@niedbalski
niedbalski / get_or_create.py
Created October 11, 2012 16:02
get_or_create a widget instance
def __init__(self):
item = gtk.MenuItem("Manage Services")
menu.append(item)
item.connect('activate', self.get_or_create_widget('services'))
def get_or_create_widget(self, widget_name):
widget_name = '%s_dialog' % widget_name
if hasattr(self, widget_name):
return lambda cb: getattr(self, widget_name).show()
return getattr(self, 'create_%s' % widget_name)
@niedbalski
niedbalski / taskgenerator.py
Created October 11, 2012 18:04
Generator with gobject
import threading, thread
import gobject, gtk
gtk.gdk.threads_init()
class GeneratorTask(object):
def __init__(self, generator, loop_callback, complete_callback=None):
self.generator = generator
@niedbalski
niedbalski / auth.py
Created November 9, 2012 21:08
hmac-encrypt-request
from Crypto.Hash import HMAC
from Crypto.Hash import SHA
import hashlib
import datetime
class Auth:
@classmethod
def sign(cls, method, c_type, body, uri, key=None):
@niedbalski
niedbalski / terms.json
Created November 26, 2012 18:24
terms
{
"www.nicky.cl": {},
"www.fayerwayer.com": {
"www.fayerwayer.com/2012/11/nomina-a-tus-candidatos-para-el-mejor-computador-portatil-del-2012/": [
{
"count": 1,
"term_type": {
"name": "Company",
"id": "Company"
},
@niedbalski
niedbalski / urls.json
Created November 26, 2012 18:29
urls
{
"www.nicky.cl": [],
"www.fayerwayer.com": [
{
"category": {
"id": "computer_internet",
"name": "computer_internet",
"created": {
"ctime": "Thu Nov 22 00:00:00 2012",
"isoweekday": 4,
@niedbalski
niedbalski / keywords.json
Created November 26, 2012 19:02
keywords
{
"www.nicky.cl": {},
"www.fayerwayer.com": {
"www.fayerwayer.com/2012/11/nomina-a-tus-candidatos-para-el-mejor-computador-portatil-del-2012/": [
{
"value": "macbook pro",
"created": {
"ctime": "Mon Nov 26 00:00:00 2012",
"isoweekday": 1,
"isoformat": "2012-11-26",