Skip to content

Instantly share code, notes, and snippets.

View werkshy's full-sized avatar

Andy O'Neill werkshy

View GitHub Profile
@werkshy
werkshy / di
Last active September 8, 2023 15:27
Digitally Imported MPD Script
#!/bin/bash
# Play a Digitally Imported station via MPD
#
# Usage:
# di list
# di trance
# di breaks
#
# Config:
@werkshy
werkshy / cr
Created October 22, 2013 18:49
Asana code review CLI
#!/usr/bin/env ruby
# cr: send an Asana ticket for code review
# It will add (or re-open) a sub-task called 'Code Review' owned
# by the specified user.
# Usage:
# cr [-a ASANA_ID] [-g GIT_COMMIT] username
#
# - If the Asana ticket ID is given, use that.
@werkshy
werkshy / statsd_admin_client.py
Last active August 3, 2021 21:06
Python class for interacting with the statsd admin interface. List stats, counters, timers, and gauges. Delete counters, timers, and gauges.
import socket
import simplejson as json
# Copyright (c) EnergyHub, Inc 2013
# Released under MIT license.
class StatsdAdminClient(object):
"""
A client for statsd admin interface.
Example commands: stats, counters, timers, gauges, delcounters, deltimers, delgauges, quit
@werkshy
werkshy / config__initializers__active_merchant.rb
Created April 2, 2014 21:12
Mock Authorize.net CIM Gateway (ActiveMerchant). Released under the MIT License
# Initializer where we inject the mock gateway into global variable AUTHNET_GATEWAY or setup the real client
if !Rails.env.production?
ActiveMerchant::Billing::Base.mode = :test
end
$using_mock_auth_net_gateway = false
# Use FORCE_AUTH_NET to use the real Auth.net API in tests
# Use MOCK_AUTH_NET to use the mock Auth.net API even in development (good on a plane!)
#!/usr/bin/env ruby
## git-publish-branch: a simple script to ease the unnecessarily complex
## task of "publishing" a branch, i.e., taking a local branch, creating a
## reference to it on a remote repo, and setting up the local branch to
## track the remote one, all in one go. you can even delete that remote
## reference.
##
## Usage: git publish-branch [-d] <branch> [repository]
##
@werkshy
werkshy / start-mysql-in-mem
Created March 29, 2013 14:37
Script to start a second mysql server using ramdisk/tmpfs for unit tests.
#!/bin/bash
DATADIR=/dev/shm/mysql
TMPDIR=/dev/shm/mysql_tmp
MYSQL_SOCKET=/dev/shm/mysql.sock
pkill -9 -f mysql.*datadir.*$DATADIR
mkdir -p $DATADIR
@werkshy
werkshy / .yamllint
Created June 25, 2018 22:37
Yamllint Config Example
extends: default
rules:
comments:
min-spaces-from-content: 1
indentation:
spaces: 2
line-length:
max: 120
#!/usr/bin/swift
//
// work.swift
//
//
// Created by Andy O'Neill on 4/20/17.
//
//
context "With Barlteby turned on" do
# TODO Get rid of NA tests and test single sku regions only when regionalization complete,
# check sku on VP instead of business region sku as well.
context "With a North American Viewable Product" do
- scenario "Lets you successfuly edit both associated skus and other fields" do
+ scenario "Lets you successfully edit both associated skus and other fields" do
+ t0 = Time.now
allow(BartlebyMode).to receive(:mode) { "full" }
viewable_product = FactoryGirl.create(:viewable_product, :bartleby_mode_full)
@werkshy
werkshy / init.rb
Last active January 11, 2017 16:18
Heroku plugin that installs busybox onto a dynos before dropping you into a bash shell.
#!/usr/bin/env ruby
# Put this file at ~/.heroku/plugins/busybox/init.rb
# Call it with 'heroku busybox'
require 'heroku/helpers'
require 'heroku/command'
require 'heroku/command/run'
class Heroku::Command::Busybox < Heroku::Command::Run