Skip to content

Instantly share code, notes, and snippets.

View theevocater's full-sized avatar
🐈‍⬛

Jake Kaufman theevocater

🐈‍⬛
View GitHub Profile
@theevocater
theevocater / gist:5358997
Created April 10, 2013 22:23
Python Random Scoping
>>> x = [1,2,3,4,5]
>>> for i in x:
... print i
...
1
2
3
4
5
>>> print i
@theevocater
theevocater / .bashrc
Created May 29, 2013 21:06
I couldn't find a concise "add npm bin" anywhere on the web so here you go. If you use npm and you need the binaries everywhere you go (ie you use less) just add this to your .bashrc and it will add it to your path.
if [[ `which npm` && -d `npm bin` ]] ; then
PATH=$PATH:`npm bin`
fi
@theevocater
theevocater / gist:5846663
Created June 23, 2013 21:46
Trying to get a "scala" version of https://github.com/lkuper/aw/ and have to do this to get it to :load in the REPL. The REPL only recognizes companion objects defined on the same line as the original class so here we have everything defined on the same "line". If I'm wrong someone please tell me how to make this less awkward.
abstract class Expr {
}; case class Number(a: Int) extends Expr {
}; case class Plus(a: Expr, b: Expr) extends Expr {
}; case class Times(a: Expr, b: Expr) extends Expr {
}; case class Minus(a: Expr, b: Expr) extends Expr {
}; object Expr {
def interp(expr: Expr): Int =
expr match {
case Number(a) => a
@theevocater
theevocater / gist:5854426
Created June 24, 2013 22:50
In which I try to compile 1 file with sbt
$ sbt
show sources
[info] Set current project to aw (in build file:/Users/jacobdeamkaufman/Code/aw.scala/)
> show sources
[info] ArrayBuffer(/Users/jacobdeamkaufman/Code/aw.scala/Expr.scala)
[success] Total time: 0 s, completed Jun 24, 2013 10:36:20 PM
> compile
[info] Updating {file:/Users/jacobdeamkaufman/Code/aw.scala/}default-60d9ca...
[info] Resolving org.scala-lang#scala-library;2.10.2 ...
[info] Done updating.
@theevocater
theevocater / gist:7763047
Created December 3, 2013 02:41
A snippet of bash to download the latest version of the git completion files locally and keep track of what version they are on
update_git_completion () {
# try to download the "correct" version of git completion
git_version=`git --version | cut -d" " -f3`
# check if we have the right version of git completion stuffs
if [[ -f git-completion.bash && -f git_completion_version && $git_version == `cat git_completion_version` ]]
then
echo "Up to date for $git_version"
else
# save the git version number
@theevocater
theevocater / compile_weirdness.rs
Last active August 29, 2015 14:06
I was messing around with closures and ran into an odd problem with lifetimes and borrowing.
// these two I just don't understand why neither works.
fn it_does_not_works() -> String {
let mut output_string = String::new();
let do_a_thing: || -> () = | | {
output_string;
};
do_a_thing();
return output_string;
@theevocater
theevocater / gist:adb46e28387c0c2f2845
Created January 9, 2015 23:51
Annoyed that homebrew's version of macvim can't be found by spotlight? I have a fix!
brew linkapps
osascript -e "tell app \"Finder\" to make new alias file at POSIX file \"/Applications\" to POSIX file \"$(stat -f%Y /Applications/MacVim.app)\"" && rm /Applications/MacVim.app;
@theevocater
theevocater / load.sh
Created March 24, 2015 20:22
load git stuff osx
# load git completion
# we can depend on git-completion locally
if [[ -f $(brew --prefix)/etc/git-completion.bash ]] ; then
. $(brew --prefix)/etc/git-completion.bash
fi
# load these separately because git-prompt was introduced with git-1.8
if [[ -s $(brew --prefix)/etc/git-prompt.sh ]] ; then
. $(brew --prefix)/etc/git-prompt.sh
fi
@theevocater
theevocater / atomic_bool.go
Last active September 24, 2015 20:51
Atomic bool in go
package main
import (
"sync/atomic"
)
type AtomicBool struct {
value *int32
}
@theevocater
theevocater / gist:474a9e751f7e765231086cab2d7a63ea
Last active October 4, 2016 12:59
Sierra upgrade woes / things

Just a short list of things I had to do during my sierra upgrade to get back to ship shape.

Homebrew

Accept the new xcode license so you can use git etc:

sudo xcodebuild -license

Take control of /usr/local again. You may not need to do this if you have a more recent homebrew than I did. homebrew now lives in /usr/local/Homebrew: