Skip to content

Instantly share code, notes, and snippets.

@roadsideseb
roadsideseb / compare_assets.py
Created Feb 13, 2014
A little script to pull all assets from 2 URL and compare the found asset URLs as well as their actual content.
View compare_assets.py
#! /usr/bin/env python
import re
import sys
import difflib
import requests
from purl import URL
URL_REGEX = re.compile(
View keybase.md

Keybase proof

I hereby claim:

  • I am elbaschid on github.
  • I am elbaschid (https://keybase.io/elbaschid) on keybase.
  • I have a public key whose fingerprint is C370 5CCB 418A D14A DD16 469D 474F 998F 42CE BD1E

To claim this, I am signing this object:

@roadsideseb
roadsideseb / create_dj17_app_config.py
Created Jun 25, 2014
A quick and dirty way to add backward-compatible app config to Django app (for Django 1.7 support)
View create_dj17_app_config.py
# -*- coding: utf-8 -*-
#! /usr/bin/env python
import os
import sys
import click
DEFAULT_CONFIG_TEMPLATE = "default_app_config = '{module_path}.{config_module}.{app_name}AppConfig'" # noqa
@roadsideseb
roadsideseb / tox.ini
Last active Aug 29, 2015
tox.ini for more than just testing
View tox.ini
[tox]
envlist = {py27,py26}-django{14,15,16}-oscar{05,06}-env{test,dev}
[testenv]
basepython =
py26: python2.6
py27: python2.7
deps =
-r{toxinidir}/requirements.txt
@roadsideseb
roadsideseb / global_login_required.py
Created Sep 2, 2014
Example for enforcing login required globally using Django's internal URL patterns and resolver
View global_login_required.py
# haiku/urls.py
urlpattnerns = [
# all the private ones
]
public_urlpatterns = [
url(....)
]
View remove_boot2docker.sh
#!/usr/bin/env bash
set -ue
if ! which boot2docker > /dev/null
then
echo "Boot2docker doesn't seem to be installed"
exit 0
fi
$(boot2docker shellinit)
@roadsideseb
roadsideseb / random_delay.py
Last active Aug 29, 2015
A little experiment to handle occasional connection timeouts when using requests to connect to an external API.
View random_delay.py
#!/usr/bin/env python
import time
import random
from flask import Flask
app = Flask(__name__)
@app.route('/timeout_sometimes')
@roadsideseb
roadsideseb / sentry.conf (nginx)
Created Oct 2, 2012
Current configuration of sentry.roadside-developer.com
View sentry.conf (nginx)
server {
listen 80;
server_name sentry.roadside-developer.com;
access_log /var/log/nginx/access.sentry.roadside-developer.com;
gzip on;
gzip_proxied any;
gzip_types text/plain application/xml application/x-javascript text/javascript text/css;
location / {
@roadsideseb
roadsideseb / git_commands.sh
Created Oct 22, 2015
Cheatsheet of git(-related) commands
View git_commands.sh
# cleanup all local branches that have been merged
git branch --delete $(git branch --merged | grep -v master)
@roadsideseb
roadsideseb / printable_enum.py
Last active Oct 23, 2015
Make the new Enum class in Python 3.4 (backported as 'enum34') have a printable representation
View printable_enum.py
# -*- encoding: utf-8 -*-
from __future__ import print_function
from enum import Enum
class PrintableValue(object):
def __init__(self, value, printable_name):
self.value = value
self.printable_name = printable_name