Skip to content

Instantly share code, notes, and snippets.

@roadsideseb
roadsideseb / random_delay.py
Last active August 29, 2015 14:20
A little experiment to handle occasional connection timeouts when using requests to connect to an external API.
#!/usr/bin/env python
import time
import random
from flask import Flask
app = Flask(__name__)
@app.route('/timeout_sometimes')
@roadsideseb
roadsideseb / git_commands.sh
Created October 22, 2015 17:18
Cheatsheet of git(-related) commands
# cleanup all local branches that have been merged
git branch --delete $(git branch --merged | grep -v master)
#!/usr/bin/env ruby
# workaround-upstart-snafu
#
# When lied to about the behavior of a job’s main process wrt. forking with the
# “expect” stanza, Upstart can get into a confused state where it’s tracking a
# nonexistent pid.
#
# This hack creates new short-lived processes until one gets the pid in
# question, then has its parent die so that it’s going to get reaped by pid 1
@roadsideseb
roadsideseb / xvfb-run.sh
Last active June 15, 2019 20:41 — forked from tyleramos/xvfb-run.sh
XVFB Run Bash script
#!/bin/sh
# $Id: xvfb-run 2027 2004-11-16 14:54:16Z branden $
# This script starts an instance of Xvfb, the "fake" X server, runs a command
# with that server available, and kills the X server when done. The return
# value of the command becomes the return value of this script, except in cases
# where this script encounters an error.
#
# If anyone is using this to build a Debian package, make sure the package
@roadsideseb
roadsideseb / Makefile
Last active January 26, 2016 23:07
Deploying image to tutum.
.PHONY: deploy build static-upload
SHELL := /bin/bash
base_image := elbaschid/python-base
builder_image := elbaschid/django-builder
tester_image := elbaschid/django-tester
image := tutum.co/elbaschid/love-fear
image_version := $(shell python deployer.py bump_version)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

The Rules of the Beer Fridge Trust

Rule #1

The beer frigde is a trust-based organism that will die if the trust is not nurtured.

Rule #2

Beer in the fridge is fair game to every member of the trust, unless explicitly labeled.

Rule #3

@roadsideseb
roadsideseb / py27_package_with_init.md
Last active December 9, 2016 19:24
Subtle difference between packages

Subtle differences in loading packages

PEP-420 is explaining the differences between regular packages and namespace packages: https://www.python.org/dev/peps/pep-0420/

Python 2.7

A package with a __init__.py:

my
@roadsideseb
roadsideseb / auto_install_dmg.sh
Last active November 10, 2016 17:50
Various ways to install packages on OSX
#!/bin/bash
#
# Install an application or library that uses a PKG installer
# wrapped inside a DMG archive. Takes the URL of the DMG and
# optionally the name of the downloaded file locally.
#
# ./auto_install_dmg.sh https://example.com/software/download/super_genius_tool_v1.2.dmg
set -uxe
download_url=${1:-"https://google.com/"}
@roadsideseb
roadsideseb / pyvideo_speaker_classification.ipynb
Last active December 12, 2016 18:50
Classification of Python conferences by men and women speaker based on pyvideo.org data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.