Skip to content

Instantly share code, notes, and snippets.

@steverichey
steverichey / keybase.md
Created October 7, 2016 00:29
keybase.md

Keybase proof

I hereby claim:

  • I am steverichey on github.
  • I am steverichey (https://keybase.io/steverichey) on keybase.
  • I have a public key whose fingerprint is 516B 6908 5CE8 D147 B985 5E42 9011 2DDB F6AB F744

To claim this, I am signing this object:

@steverichey
steverichey / keep-adb-running.sh
Last active November 28, 2018 15:23 — forked from mauron85/keep-adb-running.sh
Workaround adb disconnecting issue on macOS Sierra
#!/bin/bash
cat << EOF
###########################################################
# Workaround adb disconnecting issue on macOS Sierra
#
# More info:
# https://code.google.com/p/android/issues/detail?id=219085
# credits to: hans...@meetme.com, vs...@google.com
###########################################################
@steverichey
steverichey / egg.py
Created August 8, 2016 01:44
Automatic egg hatcher for Egg, Inc.
# Save as `egg.py`
# Run with `monkeyrunner egg.py`
# Must have Android SDK `tools` directory in your PATH
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyView
device = MonkeyRunner.waitForConnection()
# These will vary depending on your device!
x = 720
@steverichey
steverichey / csv_to_bitmap.swift
Created June 28, 2016 16:40
Convert CSV of luminance to PNG
// swiftlint:disable line_length
// swiftlint:disable variable_name
import Foundation
import Cocoa
struct PixelData {
var a: UInt8 = 255
var r: UInt8
var g: UInt8
@steverichey
steverichey / install_cuda.sh
Created June 15, 2016 16:24
CUDA ARM Setup (Ubuntu 14.04)
# install CUDA
sudo apt-get update
wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb"
sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda -y
export PATH=/usr/local/cuda-7.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH
# install MPI (optional, for some samples)
@steverichey
steverichey / SequenceType+Multifilter.swift
Created April 21, 2016 17:36
A Swift extension to perform two filters simultaneously.
extension SequenceType {
/**
Filter a single sequence into two "buckets", each an array containing objects of this collection's element type.
- parameter includeElementInFirstCollection: A method that returns true for elements to include in the first collection.
- parameter includeElementInSecondCollection: A method that returns true for elements to include in the second collection.
- returns: A tuple of two arrays containing the elements in their respective buckets.
*/
@warn_unused_result
public func multifilter(@noescape includeInFirst includeElementInFirstCollection: (Self.Generator.Element) throws -> Bool, @noescape includeInSecond includeElementInSecondCollection: (Self.Generator.Element) throws -> Bool) rethrows -> ([Self.Generator.Element], [Self.Generator.Element]) {
var firstCollection: [Self.Generator.Element] = []
@steverichey
steverichey / NeuralPlayground.swift
Created March 17, 2016 03:21
NeuralSwift - A very simple neural network written in Swift.
// see http://lumiverse.io/series/neural-networks-demystified
import Foundation
let startTime = NSDate()
defer {
let endTime = NSDate()
print("Total time \(endTime.timeIntervalSinceDate(startTime))")
}
@steverichey
steverichey / install.sh
Last active October 27, 2015 17:48
Shell script to install HaxeFlixel and dependencies on a Wercker instance
#!/bin/bash
# Install script for application setup on Wercker boxes
# Exit script on error
set -e
echo "Updating apt-get"
# Without updating, apt-get won't find curl
apt-get update
@steverichey
steverichey / icns.sh
Created August 25, 2015 02:46
A shell script to convert a single image of arbitrary size to an ICNS file in OS X.
#!/bin/sh
# exit on error
set -e
if [ "$#" -ne 1 ]; then
echo "Usage: icns myicon.png"
exit 0
fi
@steverichey
steverichey / execfix
Created April 29, 2015 16:05
Fix for OSX Yosemite "can't be opened" bug
#!/bin/sh
# Fixes "*.app can't be opened" errors
# Run `chmod +x` on this file and then
# move it to /usr/bin/ to make it GLOBAL
if [ $# -eq 0 ]
then
echo "No arguments supplied! Expected a path to a .app file"
elif [ -z "$1" ]