Skip to content

Instantly share code, notes, and snippets.

View jose-lpa's full-sized avatar

José L. Patiño Andrés jose-lpa

View GitHub Profile
@lwu
lwu / README
Created August 12, 2008 05:18
example code demonstrating Mapnik C++ API
This code snippet, modifed from Mpanik's rundemo.cpp (r727, license LGPL),
renders the State of California using USGS state boundaries data.
Here's a play-by-play (via https://lists.berlios.de/pipermail/mapnik-devel/2008-August/000679.html)
rundemo.cpp renders a map of Ontario/Quebec, and instead I wanted to draw a
map of California and its surrounding states.
I grabbed the data from the USGS in the form of "statesp020" (google it, or
browse through nationalatlas.gov) and first wanted to modify rundemo.py
@asenchi
asenchi / python.pp
Created February 20, 2010 14:56
Puppet manifest for installing Python and modules using pip
# Copyright (c) 2010 Curt Micol <asenchi@asenchi.com>
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
# THE SOFTWARE IS PROVIDED 'AS IS' AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
@revolunet
revolunet / views.py
Created February 3, 2011 17:04
add context to your django error pages
#
# by default, django 404 and 500 pages dont pass context to templates.
# as you almost *always* need context variables in your custom
# 404/500 templates, you might need MEDIA_URL for example
#
# you need to create a custom view for errors and register it in your urls.py
#
# in urls.py add :
#
# handler500 = handler404 = views.server_error

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@x-Code-x
x-Code-x / readme_install_node
Created April 30, 2012 20:52
Install npm node.js on Debian Squeeze / Wheezy / Linux Mint Debian Edition
#Quick cp from http://sekati.com/etc/install-nodejs-on-debian-squeeze
#
#Needed to install TileMill from MapBox
#
#Installs node.js which has npm bundled
#
#Build Dependencies
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev
@rla
rla / code.cpp
Created July 23, 2012 13:12
Sending JSON POST request with Qt
void SyncService::sync()
{
QUrl url(SYNC_URL);
QNetworkRequest request(url);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply*)),
@EmilStenstrom
EmilStenstrom / admin.py
Created February 12, 2013 10:32
Make values in raw_id_fields clickable...
# Example usage...
from admin_util import ImprovedModelForm
class DialogAdmin(ImprovedModelForm):
raw_id_fields = ("forum", "user", ...) # "forum" and "user" are ForeignKeys
...
@reu
reu / pub-sub.js
Created April 9, 2013 01:51
node.js redis pub-sub example
var redis = require("redis")
, subscriber = redis.createClient()
, publisher = redis.createClient();
subscriber.on("message", function(channel, message) {
console.log("Message '" + message + "' on channel '" + channel + "' arrived!")
});
subscriber.subscribe("test");
@crmccreary
crmccreary / AESCipher.py
Created May 20, 2013 02:17
Encryption using pycrypto, AES, and PKCS5 padding
from Crypto.Cipher import AES
from Crypto import Random
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
class AESCipher:
def __init__( self, key ):
"""
@alb-i986
alb-i986 / base.conf
Last active December 18, 2015 02:19
uWSGI conf for Django apps with virtualenv. Designed for uWSGI Emperor, for a multi-app hosting server, with separate Dev/Test/Prod machines. Following the DRY principle, the directives are split in 3 files: - /etc/uwsgi/templates/base.conf - /etc/uwsgi/templates/include/vars.ini - /etc/uwsgi/templates/include/vars_shared.ini Then, in /etc/uwsgi…
[uwsgi]
proj_name = %n
# load variables
ini = /var/local/django/%n/uwsgi/vars.ini
ini = /etc/uwsgi/templates/include/vars.ini
ini = /etc/uwsgi/templates/include/vars-shared.ini