Skip to content

Instantly share code, notes, and snippets.

View msgodf's full-sized avatar

Mark Godfrey msgodf

View GitHub Profile
@msgodf
msgodf / runs.md
Created March 7, 2016 17:14
Runs

Monday 7th March 2016

14 minutes 2.74km http://www.gmap-pedometer.com/?r=6814407

First run in a couple of weeks, and that was a quick 8 minute/2km one to try out my new trainers. This one started to get good around 2km, so I carried on a bit longer. A bit too quick again, but pace felt good. Legs aching and a bit heavy, and feeling tight afterwards.

@msgodf
msgodf / maximize-laptop.el
Created February 6, 2016 12:50
Function to maximize Emacs on my laptop display (Retina MacBook Pro 13", scaled for maximum space)
(defun maximize-laptop ()
"Resize to fill my laptop display, and hide menu bar"
(interactive)
(setq ns-auto-hide-menu-bar t)
(set-frame-position nil 0 -22)
(set-frame-size nil 1660 1046 'pixelwise))
@msgodf
msgodf / condition-systems.md
Created December 15, 2015 08:23
Condition Systems in an Exceptional Language by Chris Houser

Condition Systems in an Exceptional Language by Chris Houser

I recently watched Chris Houser's talk from Clojure/conj 2015 on condition systems in Clojure. I enjoyed the subject, so I decided to write up the talk as a way of encouraging me to really understand it, and in the hope that it might help others understand it.

The last time I heard about Common Lisp's condition system was at a talk by Didier Verna at ACCU in Bristol in 2013 (slides here). It sounded really interesting, but I didn't understand it well enough.

tl;dr

Chris Houser talks about different ways of handling errors in Clojure. Based on examples from Peter Seibel's book, Practical Common Lisp, he describes condition systems, which are also known as resumable exceptions, or restarts.

@msgodf
msgodf / alerting.md
Created October 13, 2015 09:58
"My Philosophy on Alerting" - Rob Ewaschuk

My Philosophy on Alerting based my observations while I was a Site Reliability Engineer at Google

Author: Rob Ewaschuk rob@infinitepigeons.org

Introduction Vernacular Monitor for your users Cause-based alerts are bad (but sometimes necessary) Alerting from the spout (or beyond!)

@msgodf
msgodf / kiczales-oopsla94-black-boxes-reuse.md
Last active March 28, 2022 22:23
Gregor Kiczales "Why are black boxes so hard to reuse?"

This talk was given by Gregor Kiczales of Xerox PARC at OOPSLA ’94, 10/26/94. © 1994, University Video Communications. A transcript, with point- and-click retrieval of the slides, is available at http:/www.xerox.com/PARC/spl/eca/oi/gregor-invite/gregor- transcript.html

Why are black boxes so hard to reuse?

I think our field will go through a revolution. We will fundamentally change the way we think about and use abstraction in the engineering of software.

The goal of this talk is to summarize the need for and the basic nature of this abstraction framework.

The change is not new problems or new systems, but a new way of thinking about existing problems and existing systems.

@msgodf
msgodf / profiles.clj
Created July 30, 2015 08:47
My .lein/profiles.clj
{:user
{:plugins [[lein-try "0.4.3"]
[lein-ring "0.9.6"]
[lein-ancient "0.6.7"]
[lein-kibit "0.1.2"]
[refactor-nrepl "1.2.0-SNAPSHOT"]
[cider/cider-nrepl "0.10.0-SNAPSHOT"]
[lein-cljfmt "0.2.1"]
[jonase/eastwood "0.2.1"]
[lein-typed "0.3.5"]]
@msgodf
msgodf / gist:b108c0c79f5245fa3f30
Created July 8, 2015 09:27
Understanding how lists get destructured as maps in Clojure
;; @andrew_jones mentioned this from Miller and Vandgrift's Applied Clojure book
;; unusual how the varargs were being destructured as if they were a map
((fn [& opts] (let [{:keys [a b c]} opts] (str a b c))) :a 1 :b 2 :c 3);;=>"123"
;; opts is a list, not a vector
(let [{:keys [a b c]} '(:a 1 :b 2 :c 3)] (str a b c));;=>"123"
(let [{:keys [a b c]} [:a 1 :b 2 :c 3]] (str a b c));;""
(let [{:keys [a b c]} [[:a 1] [:b 2] [:c 3]]] (str a b c));""
@msgodf
msgodf / gethostnames.sh
Created June 21, 2015 19:46
Get host names of any machines connected to my local network
#!/bin/bash
for i in $(seq 255);
do
nslookup 192.168.1.$(echo $i) 192.168.1.1 >/dev/null;
if [ $? -ne 1 ];
then
echo -n 192.168.1.$i;
nslookup 192.168.1.$(echo $i) 192.168.1.1|grep name|cut -d= -f2;
fi;
done
@msgodf
msgodf / gist:888d90bb90b94d87d5bf
Created June 2, 2015 07:24
Git config aliases
[alias]
st = status
lg = log
ci = commit -v
co = checkout
br = branch
# View stash diffs - use n to go to the next stash and N to go to the previous stash
stp = "!IFS=$'\n';for stash in $(git stash list);do echo $stash;echo;git --no-pager diff --color=always $(echo $stash|cut -f1 -d:);done|less -pstash"