Skip to content

Instantly share code, notes, and snippets.

@justnom
justnom / vagrant.bat
Created September 9, 2015 15:27
Vagrant wrapper for Launchy
@echo off
SET project=%1
START "vagrant" /D "C:\Projects\%project%" "C:\HashiCorp\Vagrant\bin\vagrant.exe" %2 %3 %4
@justnom
justnom / Dockerfile
Last active August 29, 2015 14:20
Docker Jenkins slave
FROM phusion/baseimage:0.9.16
CMD ["/sbin/my_init"]
RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && \
echo "mysql-server mysql-server/root_password password root" | debconf-set-selections && \
echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections && \
apt-get install -y php5-cli php5-curl php5-gd php5-mcrypt php5-memcache php5-mysql php5-intl mysql-server-5.5 openjdk-7-jdk && \
mkdir /etc/service/mysql && printf "#!/bin/bash\nexec /usr/bin/mysqld_safe" > /etc/service/mysql/run && chmod +x /etc/service/mysql/run && \
sed -ie 's|bind-address.*|bind-address = 0.0.0.0|g' /etc/mysql/my.cnf && \
@justnom
justnom / clear_tube.py
Created April 3, 2015 16:03
clear_tube.py
#!/usr/bin/env python
import sys
import beanstalkc
b = beanstalkc.Connection()
b.watch('deadtraffic')
stats = b.stats_tube('deadtraffic')
ready = stats.get('current-jobs-ready')
for x in range(0, ready):
sys.stdout.write('\rClearing {} of {}'.format(x, ready))
sys.stdout.flush()
@justnom
justnom / npm-windows-host-compat.js
Created November 12, 2014 15:32
Add compatibility for NPM long path names when using VirtualBox shared folders.
var fs = require('fs');
var path = require('path');
function deleteFolderRecursive(path) {
if (fs.existsSync(path)) {
console.log('exists');
fs.readdirSync(path).forEach(function(file, index){
var curPath = path + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) {
deleteFolderRecursive(curPath);
@justnom
justnom / table_to_string.lua
Created March 27, 2014 19:34
Lua table to string
-- Convert a lua table into a lua syntactically correct string
function table_to_string(tbl)
local result = "{"
for k, v in pairs(tbl) do
-- Check the key type (ignore any numerical keys - assume its an array)
if type(k) == "string" then
result = result.."[\""..k.."\"]".."="
end
-- Check the value type
@justnom
justnom / sentry_remove_all.js
Last active August 29, 2015 13:56
Userscript to remove all Sentry event groups on the current page.
// ==UserScript==
// @name Sentry clear all
// @namespace https://gist.github.com/justnom/9080062/
// @version 0.1
// @description clear all visible Sentry events
// @author justnom
// @match http://sentry.my-corp.com/*
// @grant none
// ==/UserScript==
@justnom
justnom / my_nodejs_app.conf
Last active August 29, 2015 13:56
Upstart job for a node.js application (this will log stderr/stdout to the log file)
description "my_nodejs_app"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn
respawn limit 99 5
script
export HOME="/home/www/nodejs"
@justnom
justnom / sync_upstream.bat
Last active August 29, 2015 13:55
Sync with a fork - this assumes no merge conflicts.
@echo off
set OLDDIR=%CD%
cd /d %TEMP%
set /p repo=Enter the forked Git repo:
set /p upstream=Enter the upstream Git repo:
:: Clone the forked repo
@justnom
justnom / short_name.bat
Created November 25, 2013 20:41
Run EXE from command line with another name.
@echo off
start my_exe_with_a_long_random_name_that_I_cannot_change.exe %1 %*
@justnom
justnom / fa_upgrade.py
Created November 25, 2013 15:20
Scan templates for old classes to upgrade to font-awesome v4.0.3.
# Scrape FontAwesome latest icon names (4.0.3)
import re
import os
from bs4 import BeautifulSoup
import requests
def soup_from_url(url):
try: