Skip to content

Instantly share code, notes, and snippets.

@lantiga
lantiga / gist:288267
Created January 27, 2010 23:20
Python NSNotificationCenter implementation
# Copyright (c) 2010, Luca Antiga, Orobix Srl.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
#!/bin/bash
#
# mkv2m4v inputfile.mkv
#
# Given an MKV container with H.264 video and AC3 audio, converts
# quickly to an iPad-compatible MP4 container without re-encoding the
# video (so it must already be in an iPad-compatible resolution); the
# audio is downmixed to stereo with Dynamic Range Compression.
#
ME=$(basename $0)
@rwilcox
rwilcox / installing_python_packages_programatically.py
Created December 26, 2010 17:32
How to use PIP to install Python packages programmatically.py
#!/usr/bin/env python
"""
PIP can stand for PIP Installs packages Programmatically, too!
(and here's how)
Requires:
* Python 2.6 or higher (for print-as-a-function)
* PIP 0.8.2
"""
@rpavlik
rpavlik / fix_homebrew.rb
Created January 6, 2011 20:32 — forked from mxcl/install_homebrew.markdown
Fix permissions on /usr/local for Homebrew
#!/usr/bin/ruby
#
# This script fixes /usr/local only.
#
# 6th January 2010:
# Modified the script to just fix, rather than install. - rpavlik
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
@philcryer
philcryer / meego-bc-installer.sh
Created May 20, 2011 02:47
Install Broadcom Wifi driver on Dell Mini9 in Meego 1.2
#!/bin/bash
# MEEGO 1.2 WIFI
# install Broadcom Wifi driver on Dell Mini9 in Meego 1.2
# created from http://slaine.org/_slaine/Meego_1.2_Wifi.html
# thanks slaine.org
sudo zypper update
sudo zypper install rpmdevtools
sudo zypper install pattern:meego-development-tools
#!/usr/bin/env bash
# An oversimplistic HLS player
# Usage:
# $ hls.sh http://example.com/path/to/list.m3u8
CURLOPTS="--buffer --connect-timeout 2 --retry 3 --retry-max-time 3"
F="/tmp/.hls.$(mcookie).ts"
L="$(tempfile -d /tmp/ -p .hls.)"
LL="$(tempfile -d /tmp/ -p .hls.)"
@gdamjan
gdamjan / eventsource.py
Last active September 30, 2015 14:08
This is a python/gevent reimplementation of this EventSource demo https://github.com/remy/eventsource-h5d/
#! /usr/bin/env python2
'''\
This is a reimplementation of a node.js demo of the Server-Sent Events API.
You can find (and compare to) the node.js version at https://github.com/remy/eventsource-h5d/.
'''
from werkzeug import Request, Response, redirect
from werkzeug.wsgi import SharedDataMiddleware
@codebutler
codebutler / JsonHelper.java
Created April 8, 2012 20:20
Convert Android JSONObject/JSONArray to a standard Map/List.
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.*;
public class JsonHelper {
public static Object toJSON(Object object) throws JSONException {
if (object instanceof Map) {
JSONObject json = new JSONObject();
@wutali
wutali / fabric.rb
Created July 10, 2012 12:30
Vagrant provisioner of Fabric.
module Vagrant
module Provisioners
class Fabric < Base
class Config < Vagrant::Config::Base
attr_accessor :fabfile_path
attr_accessor :fabric_path
attr_accessor :python_path
attr_writer :tasks
def _default_fabfile_path
@omz
omz / dropboxlogin.py
Created November 7, 2012 21:16
dropboxlogin
# YOU NEED TO INSERT YOUR APP KEY AND SECRET BELOW!
# Go to dropbox.com/developers/apps to create an app.
app_key = 'YOUR_APP_KEY'
app_secret = 'YOUR_APP_SECRET'
# access_type can be 'app_folder' or 'dropbox', depending on
# how you registered your app.
access_type = 'app_folder'