Skip to content

Instantly share code, notes, and snippets.

@goldenboy
goldenboy / contenttypes.py
Created August 9, 2012 03:42 — forked from rochacbruno/contenttypes.py
Movuca content type
class Product(ContentModel):
tablename = "product_data"
def set_properties(self):
ckeditor = CKEditor()
T = current.T
self.fields = [
Field("price", "double", notnull=True, default=0),
Field("manufacturer", "string", notnull=True),
Field("in_stock", "boolean", notnull=True, default=True),
@goldenboy
goldenboy / bootstrap-navbar-dropdown.html
Created May 5, 2012 20:27 — forked from tfausak/bootstrap-navbar-dropdown.html
Dropdown menu in Twitter Bootstrap's collapsed navbar
<!doctype html>
<html>
<head>
<meta charset=utf-8">
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet">
<style>
@goldenboy
goldenboy / check_versions.py
Created March 9, 2012 06:36 — forked from coordt/check_versions.py
Show local, remote and current versions of installed packages using Fabric
from __future__ import with_statement
from fabric.api import env, run, settings, hide, local
from fabric.decorators import hosts, runs_once
import os
import pip
import sys, xmlrpclib
from cStringIO import StringIO
from distutils.version import StrictVersion, LooseVersion
def _find_current_version(package, index_urls=None):
@goldenboy
goldenboy / 0_urllib2.py
Created March 7, 2012 18:06 — forked from kennethreitz/0_urllib2.py
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
@goldenboy
goldenboy / gist:1928239
Created February 28, 2012 00:55 — forked from jatorre/gist:1610866
Script to download all layers from SimpleGeo storage to CSV files
# The following script allows to export a SimpleGeo Storage layer to a CSV
# You have to change the credentials and the layer that you want to export
# It will generate a CSV file with the name of the layer
#
# Author: Javier de la Torre (jatorre@vizzuality.com @jatorre)
#Adapt the following to your SimpleGeo credentials. Get it from the UI.
oauth_token="token"
oauth_secret="secret"
@goldenboy
goldenboy / nominees.py
Created February 27, 2012 21:42 — forked from eyeseast/nominees.py
Aggregate the number of nominees by outcome for each congress since the 107th
#!/usr/bin/env python
# encoding: utf-8
"""
Aggregate the number of nominees by outcome for each congress since the 107th
"""
import csv
import sys
import os
sudo iptables -F
sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptables -A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT
sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A OUTPUT -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 10000 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 3333 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 3000 -j ACCEPT
@goldenboy
goldenboy / gist:1845201
Created February 16, 2012 14:25 — forked from sr3d/gist:134895
Dump a table to a CSV file
mysql -h HOST -u USERNAME --password=PASSWORD DATABASE -B -e "SELECT id,email,first_name,last_name,state,zip_code FROM users" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > filename.csv
@goldenboy
goldenboy / gist:1845200
Created February 16, 2012 14:25 — forked from sr3d/gist:148499
# getting the facebook permanent session key.
s = Facebooker::Session.new( "API_KEY", "SESCRET_KEY")
s.auth_token = "THE_6_DIGIT_CODE"
s.secure! :generate_session_secret => false
puts s.session_key
openssl genrsa -out private.key 2048
Generating RSA private key, 2048 bit long modulus
..............................+++
.+++
e is 65537 (0x10001)