Skip to content

Instantly share code, notes, and snippets.

Trevor Caira trevorc

Block or report user

Report or block trevorc

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

Keybase proof

I hereby claim:

  • I am trevorc on github.
  • I am toc ( on keybase.
  • I have a public key ASBMnVMcKtYb0Z1Q7WqbxqLRANTY5lPzmZqDjiCZiE1y8Ao

To claim this, I am signing this object:

trevorc /
Created Oct 26, 2017
Find closest server
set -eu
latency=$(ping -nqc${count} ${server} |
sed -nE 's,^round[^=]*=[^/]*/([[:digit:]]+\.[[:digit:]]+).*,\1,p')
echo "${latency} ${server}"
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import java.util.List;
import java.util.function.Consumer;
View rpn.hs
{-# LANGUAGE TupleSections #-}
module RPN (main) where
import Control.Applicative ((<$>))
import Control.Monad (forM_, unless)
import Control.Monad.Instances ()
import Data.List (find, intercalate)
import Data.Maybe (listToMaybe)
import System.IO (stdout, hFlush)
View init.el
;; Initialization ;;
(require 'cl)
(defmacro* dolist* ((iterator list &optional return-value) &rest body)
"Like `dolist' but `destructuring-bind's the elements of LIST.
If ITERATOR is a symbol then dolist* is just like `dolist' except
View .vimrc
set autowriteall
set backspace=indent,eol,start
set cinoptions=Ws,(0,t0
set directory=~/.config/vim/swap,/tmp
set encoding=utf-8
set expandtab
set formatoptions=q
set hidden
set hlsearch
set incsearch
trevorc / gist:2341940
Created Apr 9, 2012
emacs startup script
View gist:2341940
for arg; do
case $arg in
-version|--version|-f|-l|-eval|-batch|-nw) exec $app "$@"
trevorc /
Created Apr 5, 2012
How To Program ubuntu installer
set -eu
sudo -k
which easy_install &> /dev/null || wget -qO- $DISTRIBUTE_SETUP | sudo python
sudo easy_install django
sudo easy_install dotcloud
"""Bootstrap distribute installation
If you want to use setuptools in your package's, just include this
file in the same directory with it, and add this to the top of your
from distribute_setup import use_setuptools
If you want to require a specific version of setuptools, set a download
trevorc / defwith.clj
Created Mar 23, 2012
defwith -- sugar for try-finally macros
View defwith.clj
(defmacro defwith [name finalizer]
(let [bindings-sym (gensym "bindings")
body-sym (gensym "body")]
`(defmacro ~name [~bindings-sym & ~body-sym]
(empty? ~bindings-sym) `(do ~@~body-sym)
(symbol? (~bindings-sym 0))
`(let ~(subvec ~bindings-sym 0 2)
(~'~name ~(subvec ~bindings-sym 2) ~@~body-sym)
You can’t perform that action at this time.