This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
gh_url = 'https://api.github.com' | |
req = urllib2.Request(gh_url) | |
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl genrsa -out private.key 2048 | |
Generating RSA private key, 2048 bit long modulus | |
..............................+++ | |
.+++ | |
e is 65537 (0x10001) |
NewerOlder