Skip to content

Instantly share code, notes, and snippets.

View michaelxor's full-sized avatar

Michael Hofer michaelxor

View GitHub Profile
@michaelxor
michaelxor / python-fpectl-docker-build.log
Created November 16, 2017 02:20
Output from an attempted docker build which should build Python from source with the fpectl module enabled.
docker build --no-cache --force-rm -t python:2.7-jessie .
Sending build context to Docker daemon 7.168kB
Step 1/11 : FROM buildpack-deps:jessie
---> cb92533ca5cc
Step 2/11 : ENV PATH /usr/local/bin:$PATH
---> Running in 19223129a49c
---> d118a038cd5a
Removing intermediate container 19223129a49c
Step 3/11 : ENV LANG C.UTF-8
@michaelxor
michaelxor / install-ffmpeg-amazon-linux-for-lambda.sh
Last active May 5, 2016 04:35 — forked from gboudreau/install-ffmpeg-amazon-linux.sh
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
if [ "`/usr/bin/whoami`" == "root" ]; then
echo "You should not execute this script as root."
exit 1
fi
INSTALL_DIR="/tmp/ffmpeg-source"
#!/bin/bash
GEMSETS=$(find ~/.rvm/gems -maxdepth 1)
VERSION_TO_REMOVE="1.10.6"
for i in ${GEMSETS[@]}
do
GEMSET=${i##*/}
if [[ $GEMSET == "gems" || $GEMSET == "cache" ]]; then
continue
import random
def tally(votes):
max_score = 0
max_ppv = 0
winner = ''
for book, v in votes.items():
score = sum([x*(v.index(x)+1) for x in v])
ppv = 0 if not score else float(score) / sum(v)
@michaelxor
michaelxor / map.php
Last active August 29, 2015 14:00
domain map
<?php
$domain_map = array(
'omg-facts.com' => 'omgfacts.com',
'sex.omg-facts.com' => 'sex.omgfacts.com',
);
if (array_key_exists($config['site_name'], $domain_map)) {
$config['site_name'] = $domain_map[$config['site_name']];
}
/**
* a simpler version of debug_backtrace()
*
* @param boolean $show_args Pass true to display argument values in the output
* @param boolean $expand_objects when $show_args == true, pass true to expand object values, default to false to avoid over-verbosity
*
*/
function simple_backtrace( $show_args = false, $expand_objects = false )
{
$tracers = debug_backtrace();
@michaelxor
michaelxor / Preferences.sublime-settings
Created January 30, 2014 22:38
Sublime Text Preferences
{
"always_show_minimap_viewport": true,
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"caret_style": "phase",
"ensure_newline_at_eof_on_save": true,
"find_selected_text": true,
"fold_buttons": false,
"folder_exclude_patterns":
[
#!/bin/bash
#
# Python
#
# This will install the latest python 2.x branch via
# Homebrew, install virtualenv and virtualenvwrapper packages
# globally via pip, then create a base virtual environment under
# the branch and install the packages in requirements.txt
#
# alternate version that does not depend on virtualenvwrapper is
@michaelxor
michaelxor / pymordial.sh
Last active January 10, 2017 10:30
A clean virtualenv with pip and setuptools (formerly distribute). Only requirement is a local python install. Adapted from http://stackoverflow.com/a/5177027
# Name your first "bootstrap" environment:
INITIAL_ENV=pymordial
# Options for your first environment:
ENV_OPTS=''
# Set to whatever python interpreter you want for your first environment:
PYTHON=$(type -P python)
# Latest virtualenv from pypa