Skip to content

Instantly share code, notes, and snippets.


Andy Prock aprock

  • Seattle, WA
View GitHub Profile
View .gitconfig
st = status
stat = status
ci = commit
co = checkout
br = branch
ls = ls-files
undo = reset --soft HEAD^
merge = merge --no-commit
cdiff = diff --cached
aprock / simpleserver.js
Created Aug 7, 2015
simple web server that returns www-authenticate
View simpleserver.js
var express = require('express')
var app = express()
app.use(function (req, res, next) {
res.writeHead(401, "Unauthorized",
{ 'Content-Type': 'application/json',
'www-authenticate': 'Basic realm="My Realm"' });
console.log('401 refused ' + new Date() + ' (' + (new Date).getTime() + ')');
aprock / stampit-collections.js
Last active Aug 29, 2015
exploring stampit samples
View stampit-collections.js
// playing with the bar example from
// added a concept of specials
'use strict';
var stampit = require('stampit');
// Some more privileged methods, with some private data.
// Use stampit.mixin() to make this feel declarative:
var availability = stampit().init(function () {
aprock / ssdp-discovery.js
Last active Mar 23, 2016
ssdp discovery with node.js
View ssdp-discovery.js
// original:
var dgram = require('dgram'); // dgram is UDP
var matcher = process.argv[2] ? new RegExp(process.argv[2]) : undefined;
function search() {
var client = dgram.createSocket("udp4");
client.once('listening', function() {
View .bash_profile
# ---------------------------------------------------------------------------
# Description: This file holds all my BASH configurations and aliases
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
View .bash_profile
# launchctl unload -w /System/Library/LaunchAgents/
# defaults write mcx-disabled -boolean true
export GRADLE_OPTS="-Xms1024m -Xmx2048m"
export JAVA_OPTS="-Xms1024m -Xmx2048m"
export ANDROID_HOME=/usr/local/opt/android-sdk
export USE_CCACHE=1
aprock / SystemJack.applescript
Last active Apr 1, 2019
Automate Audio Hijack Pro create a new Run Applescript Automator Action, and place it in the login items
View SystemJack.applescript
on run {input, parameters}
tell application "Audio Hijack Pro"
set miniaturized of windows to true -- most apps
end try
start hijacking (first session whose name is "System")
end tell
return input
end run
aprock /
Created Aug 12, 2013
Rounded Corner Image Transformation for square's Picasso
// enables hardware accelerated rounded corners
// original idea here :
aprock /
Last active Mar 28, 2019
simple trick to autoplay an html5 video element in a webview. (inject javascript to play on load)
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
private WebView webview;
aprock / airspeak.js
Last active Dec 18, 2015
node-speak + node-airtunes to make my remote speakers entertain me.
View airspeak.js
var speak = require("node-speak")
, airtunes = require('airtunes')
, Buffer = require('buffer').Buffer
, spawn = require('child_process').spawn
, streamBuffers = require("stream-buffers")
, argv = require('optimist')
.usage('Usage: $0 --host [host] --port [num] --ffmpeg [path] --words [string] --volume [num] --password [string]')
.default('port', 5000)
.default('volume', 50)
.default('ffmpeg', '/usr/local/bin/ffmpeg')
You can’t perform that action at this time.