Skip to content

Instantly share code, notes, and snippets.

View warmwaffles's full-sized avatar
🛠️
Code Wrestling

Matthew Johnston warmwaffles

🛠️
Code Wrestling
View GitHub Profile
import com.google.common.base.Preconditions;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
@warmwaffles
warmwaffles / access_token.js
Created December 1, 2013 04:55
Based loosely on `simple-oauth2`
'use strict';
require('date-utils');
var underscore = require('underscore');
/**
* Constructs a brand new AccessToken
*
* @param client {OAuth2.Client} The OAuth2 client that will be used for
'use strict';
/**
* Block class is used for routing errors to higher level logic.
*/
function Block(errback) {
this._parent = Block.current;
this._errback = errback;
}
Block.current = null;
class EnableUuid < ActiveRecord::Migration
def change
enable_extension 'uuid-ossp'
end
end
// #############################################################################
// Configurations
// #############################################################################
group = 'com.someapp'
version = '1.0.0'
mainClassName = "${group}.Launcher"
description = "Some description"
buildDir = 'build/'
// #############################################################################
package net.warmwaffles.utils.concurrent;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
/**
* A light wrapper around the {@link ThreadPoolExecutor}. It allows for you to pause execution and
#!/bin/sh
# title : yaourt-install
# description: This script install yaourt downloading and compiling package-query and yaourt
# author : Christopher Fernández
# usage : yaourt-install
echo "================================================"
echo "Remember that you need to be in the sudoers file"
echo "to install Yaourt successfully."
echo "================================================"
@warmwaffles
warmwaffles / Vagrantfile
Last active August 29, 2015 13:56
Failed salt-bootstrap arch
Vagrant.configure('2') do |config|
config.vm.box = 'arch64' # http://vagrant.srijn.net/archlinux-x64-2014-01-07.box
config.vm.synced_folder('srv/', '/srv/')
inline = [
'pacman -Syu --noconfirm'
].join(';')
config.vm.provision(:shell, inline: inline)
config.vm.provision(:salt) do |salt|
#!/bin/bash
PORT=$1
${PORT:=8000}
python -m SimpleHTTPServer $PORT
require 'benchmark'
max = (ARGV.shift || 10_000_000).to_i
puts "# of iterations = #{max}"
Benchmark::bm(20) do |x|
x.report("each") do
(0..max).each do
end
end