Skip to content

Instantly share code, notes, and snippets.

View Apreche's full-sized avatar
🚲

Scott Rubin Apreche

🚲
View GitHub Profile
#!/usr/bin/env bash
# git_venv_bash_prompt.sh
#
# This builds a bash prompt that is aware of git and virtualenv
#
# to make this work put this file somewhere on your machine
# then put the following line in your .bashrc
# source /path/to/git_venv_bash_prompt.sh
# bash colors
#!/usr/bin/env/python
"""
gdocs2s3.py
Automatically downloads all of your Google Docs and backs them up to Amazon S3
"""
"""
Copyright (c) 2010 Scott Rubin apreche@frontrowcrew.com
<?php
/*
Extension Name: Html Formatter
Extension Url: http://lussumo.com/docs/
Description: Allows html to be used in strings, but breaks out all "script" related activities.
Version: 2.4
Author: SirNotAppearingOnThisForum
Author Url: N/A
*/
from django.conf import settings
from django.contrib.sites.models import Site
from celery.task import Task
from celery.registry import tasks
from bitlyapi import BitLy
from twitter import Api
class Tweet(Task):
@Apreche
Apreche / BasicView.py
Created November 11, 2010 03:21
A decorator to make the typical view in Django less verbose
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
class BasicView(object):
"""
Almost every view I write in django follows this structure:
def view(request):
...
@Apreche
Apreche / mkgithub.sh
Created November 17, 2010 17:25
Create a github repository from the current directory
#!/bin/bash
# This will turn the current directory into a repo on Github
# Set the username and password as environment variables like so, in bashrc:
# export GITHUB_USER="User Name Goes Here"
# export GITHUB_TOKEN="API Token Goes Here"
CWD=`basename $PWD`
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@Apreche
Apreche / gist:1143791
Created August 13, 2011 12:19
Create siege file from access_log
$ cut -d ' ' -f7 /var/log/apache2/access.log > urls.txt
$ siege -c<concurreny rate> -b -f urls.txt
@Apreche
Apreche / vanillafix.py
Created October 27, 2011 03:26
Reformats comments from Vanilla 1 to Vanilla 2 style
#!/usr/bin/env python
# Rerformat comments for transition from Vanilla1 to Vanilla 2
import re
import MySQLdb
from BeautifulSoup import BeautifulSoup
connection = MySQLdb.connect(user='root',db='newforum', use_unicode=True)
select_cursor = connection.cursor()
@Apreche
Apreche / screenrc
Last active October 1, 2015 04:38
screenrc
startup_message off
shell "/bin/bash"
caption always "%{= kB}%-Lw%{=s kB}%50>%n%f* %t %{-}%+Lw%<"