Skip to content

Instantly share code, notes, and snippets.

View stouset's full-sized avatar

Stephen Touset stouset

View GitHub Profile
git checkout -b $new_branch_name $branch_you_did_the_changes_on # create a new branch with all the changes
git checkout $branch_you_did_the_changes_on # go back to the branch you did the work on
git stash -u # stash all your changes and any new files
git status # confirm a "clean" state
git reset --hard master # reset your branch back to being unchanged from `master`
git checkout master
git merge $new_branch_name # merge in the changes from the new branch
git checkout $branch_you_did_the_changes_on
git rebase master # fast-forward to the new state of master
git stash pop # bring all your changes back
diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am
index da5900e..f26576a 100644
--- a/src/libsodium/Makefile.am
+++ b/src/libsodium/Makefile.am
@@ -4,25 +4,32 @@ lib_LTLIBRARIES = \
libsodium_la_SOURCES = \
crypto_auth/crypto_auth.c \
+ crypto_auth/hmacsha256/auth_hmacsha256.c \
crypto_auth/hmacsha256/ref/api.h \
64 bytes from 98.234.232.1: icmp_seq=37 ttl=254 time=17.685 ms
Request timeout for icmp_seq 48
Request timeout for icmp_seq 49
Request timeout for icmp_seq 50
Request timeout for icmp_seq 51
Request timeout for icmp_seq 52
Request timeout for icmp_seq 53
Request timeout for icmp_seq 54
Request timeout for icmp_seq 55
Request timeout for icmp_seq 56
@stouset
stouset / gist:4540809
Created January 15, 2013 18:30
emacs-mac installation workaround
~ $ brew install --debug --HEAD emacs-mac
/usr/local/bin/brew: loading /usr/local/Library/Formula/emacs-mac.rb
/usr/local/Library/Formula/emacs-mac.rb: loading /usr/local/Library/Formula/python.rb
==> Cloning git://github.com/railwaycat/emacs-mac-port.git
Updating /Library/Caches/Homebrew/emacs-mac--git
==> ./configure --prefix=/usr/local/Cellar/emacs-mac/HEAD --without-dbus --enabl
==> make
cd /private/tmp/emacs-mac-r3ND && aclocal -I m4
/bin/sh: aclocal: command not found
make: *** [/private/tmp/emacs-mac-r3ND/aclocal.m4] Error 127
(setenv "PATH"
(concat (expand-file-name "~/.rbenv/shims:")
(expand-file-name "~/.rbenv/bin:")
(getenv "PATH")))
(setq exec-path
(append
(list (expand-file-name "~/.rbenv/shims")
(expand-file-name "~/.rbenv/bin"))
exec-path))
(setenv "PATH"
(concat (expand-file-name "~/.rbenv/shims:")
(expand-file-name "~/.rbenv/bin:")
(getenv "PATH")))
(setq exec-path
(append
(list (expand-file-name "~/.rbenv/shims")
(expand-file-name "~/.rbenv/bin"))
exec-path))
@stouset
stouset / gist:3305205
Created August 9, 2012 15:35
def_method_missing
class Foo
# regexp matchers yield the MatchData to the block, so you can modify the method
# body based on the regexp
def_method_missing /bar/ do |match|
-> { match.pre_match }
end
# without a regexp matcher, the name of the method is passed to the block, allowing
# you to decide whether or not to implement the method
def_method_missing do |name|
@stouset
stouset / composition.rb
Created August 8, 2012 15:15
Function Composition
class Proc
def +(other)
->(*a1, &b1) do
->(*a2, &b2) do
inner = other.to_proc.call(*a1, &b1)
outer = self .call(inner, *a2, &b2)
end
end
end
end
require 'active_support/concern'
module Hash::PurgeIf
include ActiveSupport::Concern
included do |base|
raise 'Hash#purge_if already defined' if
base.instance_methods.include?(:purge_if)
end
def purge_if
self.inject({}) do |hash, (key, value)|
yield(key, value) ? hash : hash.update(key => self.delete(key))
end
end