Skip to content

Instantly share code, notes, and snippets.

Andy Prock aprock

  • Seattle, WA
Block or report user

Report or block aprock

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .gitconfig
[alias]
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
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"' });
res.end('{"error":[401,"Unauthorized"]}');
console.log('401 refused ' + new Date() + ' (' + (new Date).getTime() + ')');
@aprock
aprock / stampit-collections.js
Last active Aug 29, 2015
exploring stampit samples
View stampit-collections.js
// playing with the bar example from https://github.com/ericelliott/stampit
// 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
aprock / ssdp-discovery.js
Last active Mar 23, 2016
ssdp discovery with node.js
View ssdp-discovery.js
// original: https://gist.github.com/chrishulbert/895382
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.bind();
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/com.apple.notificationcenterui.plist
# defaults write com.apple.dashboard mcx-disabled -boolean true
export GRADLE_OPTS="-Xms1024m -Xmx2048m"
export JAVA_OPTS="-Xms1024m -Xmx2048m"
export ANDROID_HOME=/usr/local/opt/android-sdk
export BUILD_MAC_SDK_EXPERIMENTAL=1
export USE_CCACHE=1
@aprock
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"
try
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
aprock / RoundedTransformation.java
Created Aug 12, 2013
Rounded Corner Image Transformation for square's Picasso
View RoundedTransformation.java
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Shader;
// enables hardware accelerated rounded corners
// original idea here : http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/
@aprock
aprock / autoplay.java
Last active Mar 28, 2019
simple trick to autoplay an html5 video element in a webview. (inject javascript to play on load)
View autoplay.java
import android.annotation.SuppressLint;
import android.app.Activity;
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
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.