Skip to content

Instantly share code, notes, and snippets.

@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.
@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/"}

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

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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)
@roadsideseb
roadsideseb / the_mobifier.py
Created June 1, 2014 07:16
What does the MobifyBlog say about what an employee at Mobify is called?
# -*- coding: utf-8 -*-
from __future__ import print_function
import re
import feedparser
from collections import defaultdict
MOBIF_REGEX = re.compile(r'(?i)mobif\w+')
======================================================================
ERROR: upload devices from inventory file
----------------------------------------------------------------------
File "/usr/lib/python2.7/unittest/case.py", line 332, in run
testMethod()
File "/home/elbaschid/Worx/Tangent/vodafone/tests/eshop/functional/test_upload_inventory.py", line 114, in test_upload_inventory
after_save_page = save_form.submit().maybe_follow()
File "/home/elbaschid/.virtualenvs/vodafone/local/lib/python2.7/site-packages/webtest/forms.py", line 538, in submit
params=fields, **args)
File "/home/elbaschid/.virtualenvs/vodafone/local/lib/python2.7/site-packages/webtest/response.py", line 293, in goto
import xml
from boto.mws import response
from boto.handler import XmlHandler
from boto.mws.connection import MWSConnection
from unittest import TestCase
NESTED_MEMBER_LIST_XML = """<GetTestResponse>
#!/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