Skip to content

Instantly share code, notes, and snippets.


Trever Shick trevershick

View GitHub Profile
View test.cpp
#include <cstring>
#include <functional>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
class MyBuf : public std::streambuf {
MyBuf(int maxLength, std::function<void(const char *, int)> callbackFn);
trevershick / CMakeLists.txt
Last active Jan 23, 2019
Simple client and server using libuv and unix domain sockets...
View CMakeLists.txt
cmake_minimum_required(VERSION 2.8.12)
add_executable(server server.cpp)
View logfile-spec.js
var bucket = "a-bucket";
var filename = "logs/abc";
var event = {
"Records": [
"s3": {
"object": {
trevershick /
Last active Sep 17, 2015 — forked from katta/
Script to add colors to maven output
#!/usr/bin/env bash
# Formatting constants
export BOLD=`tput bold`
export UNDERLINE_ON=`tput smul`
export UNDERLINE_OFF=`tput rmul`
export TEXT_BLACK=`tput setaf 0`
export TEXT_RED=`tput setaf 1`
export TEXT_GREEN=`tput setaf 2`
export TEXT_YELLOW=`tput setaf 3`
trevershick / diff_from_trunk
Last active Aug 29, 2015
Subversion - Lists out all files that have changes when compared to trunk
View diff_from_trunk
# Lists out all files that have changes when compared to trunk
# this assumes the name of the current directory
# is the name of the folder in ^/trunk/<<folder>>
BASE=$(pwd); BASE=$(basename $BASE); svn diff ^/trunk/$BASE . | grep Index | grep "\." | cut -d " " -f2 | xargs basename | sort | uniq
trevershick / svn_short_log
Last active Sep 12, 2018 — forked from plexus/svn_short_log
svn log, one line per commit
View svn_short_log
#!/usr/bin/awk -f
# Convert the "svn log" output into a one liner format, which is easier to grep
# or use in scripts. Pipe "svn log" into this script
# When we get a line that starts with a revision number, put the data in variables
/^r[0-9]+/ {
View formatbytes.js
// thanks
function formatBytes(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
trevershick / console.js
Last active Aug 29, 2015
Simple, easy to use console replacement script for use in JsFiddle...
View console.js
if (typeof($) === 'undefined') {
alert('jquery is required');
$("body").append($('<div id="console-log"></div>').css({
var consoleLineCss = {

Setting Up Clojure on OS X

I spent a lot of time trying to find a pretty optimal (for me) setup for Clojure… at the same time I was trying to dive in and learn it. This is never optimal; you shouldn't be fighting the environment while trying to learn something.

I feel like I went through a lot of pain searching Google, StackOverflow, blogs, and other sites for random tidbits of information and instructions.

This is a comprehensive "what I learned and what I ended up doing" that will hopefully be of use to others and act as a journal for myself if I ever have to do it again. I want to be very step-by-step and explain what's happening (and why) at each step.

Step 1: Getting Clojure (1.3)

trevershick /
Created Oct 16, 2013
Sample code showing how even after a Guava transform, the underlying collection may still be altered.
import static;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
You can’t perform that action at this time.