Skip to content

Instantly share code, notes, and snippets.

View biwin's full-sized avatar
🎯
Focusing

Biwin Joseph biwin

🎯
Focusing
View GitHub Profile
@neonichu
neonichu / web.rb
Created May 25, 2015 13:22
GitHop web app
require 'githop'
require 'sinatra'
def githop_html(user)
config = {
'bigquery' => {
'client_id' => ENV['BIGQUERY_CLIENT_ID'],
'service_email' => ENV['BIGQUERY_SERVICE_EMAIL'],
'keyfile' => ENV['BIGQUERY_KEYFILE'],
'project_id' => ENV['BIGQUERY_PROJECT_ID']
@skyebook
skyebook / backup_postgres.sh
Last active April 16, 2016 13:20
Backup OpenShift PostgreSQL Database
#!/bin/bash
# Backs up the OpenShift PostgreSQL database for this application
# by Skye Book <skye.book@gmail.com>
NOW="$(date +"%Y-%m-%d")"
FILENAME="$OPENSHIFT_DATA_DIR/$OPENSHIFT_APP_NAME.$NOW.backup.sql.gz"
pg_dump $OPENSHIFT_APP_NAME | gzip > $FILENAME
@agriffis
agriffis / gist:2481292
Created April 24, 2012 16:37
.bashrc.virtualenvwrapper
# Dynamically load virtualenvwrapper functions to reduce shell startup
# time.
#
# Copyright 2012 Aron Griffis <aron@arongriffis.com>
# Released under the GNU GPL v3
#######################################################################
# Python virtualenvwrapper loads really slowly, so load it on demand.
if [[ $(type -t workon) != function ]]; then
virtualenv_funcs=( workon deactivate mkvirtualenv )
@kesor
kesor / profile_middleware.py
Last active March 16, 2021 15:37
Django cProfile middleware
from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
import cProfile
import pstats
import marshal
from cStringIO import StringIO
class ProfileMiddleware(object):
def __init__(self):
if not settings.DEBUG:
@kennethreitz
kennethreitz / 0_urllib2.py
Created May 16, 2011 00:17
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()