Skip to content

Instantly share code, notes, and snippets.

View OnlyInAmerica's full-sized avatar

David Brodsky OnlyInAmerica

  • Oakland, CA
View GitHub Profile
@OnlyInAmerica
OnlyInAmerica / CameraActivity.java
Created May 8, 2014 16:58
Kickflip Android SDK Example Camera Application
package io.kickflip.sample.activity;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
import java.io.File;
import io.kickflip.sample.R;
@OnlyInAmerica
OnlyInAmerica / glacier_backup.py
Last active August 29, 2015 14:01
Glacier directory Backup
'''
Makes a tarfile from every top-level directory in BACKUP_PATH
and transmits that to Amazon Glacier.
Requirements:
Environmental Variables:
+ AWS_ACCESS_KEY_ID
+ AWS_SECRET_ACCESS_KEY
@OnlyInAmerica
OnlyInAmerica / gist:2b1b175652a9950627d7
Last active August 29, 2015 14:01
Streaming with Kickflip for iOS
[Kickflip setupWithAPIKey:@"CLIENT_ID" secret:@"CLIENT_SECRET"];
[Kickflip presentBroadcasterFromViewController:self ready:^(KFStream *stream){
if (stream) {
NSLog(@"Stream is ready to view at URL: %@", stream.streamURL);
}
}
completion:^{
NSLog(@"Finished broadcasting.");
}];
@OnlyInAmerica
OnlyInAmerica / gist:91dd00a612fbcd2dab1f
Created May 14, 2014 20:17
Streaming with Kickflip for Android
Kickflip.setup(this, "CLIENT_ID", "CLIENT_SECRET");
Kickflip.startBroadcastActivity(this, new BroadcastListener() {
@Override
public void onBroadcastStart() {
// The user began broadcasting
}
@Override
public void onBroadcastLive(Stream stream) {
// This device's broadcast is live!
@OnlyInAmerica
OnlyInAmerica / gist:d11f52b73b5e02c858ce
Last active August 29, 2015 14:01
Delete old S3 Buckets
'''
Find oldest created buckets in your AWS account and optionally delete them
Requirements:
Environmental Variables:
+ AWS_ACCESS_KEY_ID
+ AWS_SECRET_ACCESS_KEY
Python packages:
@OnlyInAmerica
OnlyInAmerica / SECRETS.java
Created June 10, 2014 22:04
Specifying Kickflip keys for a sample app
package io.kickflip.glasscast;
public class SECRETS {
public static final String CLIENT_KEY = "YourKickflipKey";
public static final String CLIENT_SECRET = "YourKickflipSecret";
}
@OnlyInAmerica
OnlyInAmerica / IronRouterRedirect.js
Created June 30, 2014 18:00
How to redirect with Iron-Router without breaking Browser's back function
// My Iron-Router map has these two routes
// I'd like to redirect all requests to /forum/:id
// onward to /forum/:id/:slug
// Using this.redirect(...) works but prevents the
// browser from navigating "back"
this.route('questionDetailWithSlug', {
template: 'questionDetail',
path: '/forum/:id/:slug',
action: function(){
@OnlyInAmerica
OnlyInAmerica / gist:389b8e8d9e3867b51476
Created September 5, 2014 08:43
RajaWali Interior Shape Rendering
getCurrentCamera().setPosition(0, 0, 0);
Sphere sphere = new Sphere(10, 24, 24);
/** Below renders a portion of the exterior of the sphere with texture applied */
sphere.setPosition(0, 0, -13);
/** Below renders nothing when I'd expect to "see" the interior of the sphere */
//sphere.setPosition(0, 0, 0);
Material material = new Material();
material.addTexture(new Texture("brc", R.drawable.brc_sm));
sphere.setMaterial(material);
@OnlyInAmerica
OnlyInAmerica / crop_frames.py
Created December 9, 2014 22:28
Assemble an image hidden among multiple video frames.
'''
Construct a single image by stacking the bottom READ_HORIZ_PX
of each source frame of form image-XXXX.jpeg.
To create source frames of form image-XXXX.jpeg from a video file:
$ ffmpeg -i inputfile.avi image-%4d.jpeg
This was helpful in extracting a QR code partially displayed
across many frames.
'''
@OnlyInAmerica
OnlyInAmerica / gist:e0e73ae971791c652c61
Created May 23, 2015 05:59
Pull and decompile Android APK (Jank Edition)
import sys
import subprocess
DEX2JAR_PATH = ‘/PATH/TO/dex2jar-2.0/d2j-dex2jar.sh' # https://github.com/pxb1988/dex2jar
APKTOOL_JAR_PATH = ‘PATH/TO/apktool.jar' # http://ibotpeaches.github.io/Apktool/install/
JDCLI_JAR_PATH = '/PATH/TO/jd-cli.jar' # https://github.com/kwart/jd-cmd
# TODO SANITIZE INPUT
query = sys.argv[1]