Skip to content

Instantly share code, notes, and snippets.

@onyxfish
onyxfish / fabfile.py
Created February 9, 2010 23:05
Chicago Tribune News Applications fabric deployment script
from fabric.api import *
"""
Base configuration
"""
env.project_name = '$(project)'
env.database_password = '$(db_password)'
env.site_media_prefix = "site_media"
env.admin_media_prefix = "admin_media"
env.newsapps_media_prefix = "na_media"
Bitly tech talk 4/22/2010
On 4/22 we held a bit.ly tech talk on 'Command Line Fu', where we invited talented hackers to come share their best moves. Please correct my notes and add your fu here!
# jehiah
# in place file regex replacement
perl -pi -e 's/this/that/g' filename_pattern
# print the last column
@edufelipe
edufelipe / prettyjson.py
Created July 13, 2010 18:43
Script to prettyprint and highlight json to terminal
#!/usr/bin/env python
import cStringIO
import json
import sys
from pygments import highlight
from pygments.formatters import TerminalFormatter
from pygments.lexers.web import JavascriptLexer
@garnaat
garnaat / iam_ec2_example.py
Created September 15, 2010 04:48
Use IAM/boto to provide access to EC2 and S3
"""
IAM boto examples:
In this example we create a group that provides access
to all EC2 and S3 resources and actions and then add a
user to that group.
"""
import boto
#
# First create a connection to the IAM service
@garnaat
garnaat / iam_admin_example.py
Created September 15, 2010 13:51
Use IAM/boto to create an Admin group
"""
IAM boto examples:
In this example, we show how to create a group
for administrators who have full access to IAM
functionality but no access to other AWS services.
"""
import boto
#
# First create a connection to the IAM service
@jehiah
jehiah / twitter_archiver.py
Created December 17, 2010 05:00
python script to archive your tweets
#!/usr/bin/env python
"""
twitter_archiver.py written by Jehiah Czebotar 2010 <jehiah@gmail.com> http://jehiah.cz/
this uses the great 'python twitter tools' library by Mike Verdone
http://mike.verdone.ca/twitter/
usage:
$ pip install twitter
@border
border / Makefile
Created January 12, 2011 01:36
json example in golang
include $(GOROOT)/src/Make.inc
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
all:
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
format:
$(GOFMT) -w jsontest.go
@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@garnaat
garnaat / firstlaunch.py
Created May 18, 2011 12:16
Simple example of creating your first instance in EC2
import boto.ec2
import os, time
# define region_name to be region you want to connect to
region_name = 'eu-west-1'
conn = boto.ec2.connect_to_region(region_name)
# First upload a public key to use for SSH'ing to instance. Use "ssh-keygen" to generate.
fp = open(os.path.expanduser('~/.ssh/mykey.pub'))
material = fp.read()
@mndoci
mndoci / iam_fog.rb
Created May 29, 2011 03:48 — forked from zapnap/iam_fog.rb
Using Amazon IAM with Fog (example)
# via http://blog.zerosum.org/2011/03/02/better-aws-access-control-with-iam-and-fog.html
require 'fog'
username = 'testuser'
bucket = 'uniquebucketname1234'
aws_credentials = {
:aws_access_key_id => 'YOUR-ACCESS-KEY-ID',
:aws_secret_access_key => 'YOUR-SECRET-ACCESS-KEY'