Skip to content

Instantly share code, notes, and snippets.


Zac Sweers ZacSweers

View GitHub Profile
View pub_machine
## Source this to add the functions to your environment
function choice {
lc=$(wc -l < $file)
if [ ${lc} -gt 0 ]; then
sed -n "$((1 + $RANDOM % ${lc})) p" ${file}
BobertForever /
Last active Aug 29, 2015
Delete all members of a facebook group using Selenium
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from facepy import GraphAPI
import contextlib
import time
import threading
usr = 'FB_USER'
pwd = 'FB_PASS'
View gist:b12f10e3951cf595664c
public class MenuPreference extends ListPreference {
private View anchor;
public MenuPreference(Context context) {
public MenuPreference(Context context, AttributeSet attrs) {
super(context, attrs);
tecoholic /
Created May 23, 2011
This sample code (written in Python) demonstrates integrating Facebook Chat using the X-FACEBOOK-PLATFORM authentication mechanism.
#!/usr/bin/env python
# This is a demonstration script for Facebook Chat
# using the X-FACEBOOK-PLATFORM SASL mechanism.
# It requires pyfacebook and pyxmpp to be installed.
# This client only works for desktop applications (configured in the
# developer app), and uses the old-style auth.getSession mechanism to get a
# Facebook session. For newer-style or web apps, only the
# `get_facebook_client` function should have to change.
blech / caltrain.geojson
Last active Dec 3, 2015
Caltrain Ridership
View caltrain.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
agscala /
Created Jan 30, 2013
python [vine_url] [output_file] Scrapes vine url, downloads video, and converts the file to a gif with mplayer
from pyquery import PyQuery as pq
import sys
import subprocess
import os
from urllib2 import urlopen, URLError, HTTPError
def convert(input_file, output_gif):
print "CONVERT", input_file, " => ", output_gif["mplayer", input_file, "-ao", "null", "-ss", "0:0:0", "-endpos", "6", "-vo", "gif89a:fps=8:output=%s" % output_gif, "-vf", "scale=240:180"])
sabadow /
Created Oct 25, 2013
github / gauges-android monkey runner
# Imports the monkeyrunner modules used by this program
from import MonkeyRunner, MonkeyDevice
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
# Installs the Android package. Notice that this method returns a boolean, so you can test
# to see if the installation worked.
cpatulea / gist:7394412
Created Nov 10, 2013
Find Python string literals that should probably be Unicode
View gist:7394412
import ast, _ast, os
for root, dirs, files in os.walk('.'):
for name in files:
if name.endswith('.py'):
full = os.path.join(root, name)
t = ast.parse(open(full).read())
for n in ast.walk(t):
if isinstance(n, _ast.Str) and not isinstance(n.s, unicode):

Set up Robolectric with Gradle

  1. Open your top level build.gradle file.

  2. Add Sonatype repo to buildscript repositories and Square Gradle Android Test Plugin to buildscript dependencies. (Older Gradle projects may automatically put this buildscript code in your project build.gradle, in which situation you should put the following in that file.)

MichaelEvans / appcompat.diff
Last active Mar 27, 2016
Changelog for Support Libraries v23.2.0 -> v24.0.0-alpha1
View appcompat.diff
diff -U 0 -N appcompat-v7-23.2.0_ff0f8a1a/$PanelFeatureState appcompat-v7-24.0.0-alpha1_4f276de6/$PanelFeatureState
--- appcompat-v7-23.2.0_ff0f8a1a/$PanelFeatureState 1969-12-31 19:00:00.000000000 -0500
+++ appcompat-v7-24.0.0-alpha1_4f276de6/$PanelFeatureState 2016-03-09 19:28:22.000000000 -0500
@@ -0,0 +1,5 @@
+public final class$PanelFeatureState {
+ public boolean qwertyMode;
+ public boolean hasPanelItems();
+ public void clearMenuPresenters();
diff -U 0 -N appcompat-v7-23.2.0_ff0f8a1a/ appcompat-v7-24.0.0-alpha1_4f276de6/