Skip to content

Instantly share code, notes, and snippets.

View dgoeke's full-sized avatar

David Goeke dgoeke

  • Cotati, CA
View GitHub Profile
{ config, pkgs, ... }:
{
home = {
username = "dg";
homeDirectory = "/home/dg";
stateVersion = "21.03";
sessionPath = [
"/home/dg/.emacs.d/bin/"
];
@dgoeke
dgoeke / coby.sh
Last active March 13, 2019 18:16
co-authored-by
#!/usr/bin/env sh
get_user() {
URL="https://api.github.com/users/$1"
RESULT=$(curl -s "$URL")
ID=$(echo "$RESULT" | sed -En 's/.*"id": ([0-9]+).*/\1/p')
NAME=$(echo "$RESULT" | sed -En 's/.*"name": "(.*)".*/\1/p')
echo "Co-authored-by: $NAME <$ID+$1@users.noreply.github.com>"
}

Keybase proof

I hereby claim:

  • I am dgoeke on github.
  • I am dgoeke (https://keybase.io/dgoeke) on keybase.
  • I have a public key ASB8POM88ps-TjRABEkKicFWTOWVtecLbZH82mRsG_Lh4go

To claim this, I am signing this object:

@dgoeke
dgoeke / gist:2c8eb159cee7f019603f
Created June 16, 2015 18:16
Asynchronous processes and cancellation
(defn exec-cancellable
[cmd cancel]
(let [proc (sh/proc "sh" "-c" cmd)
exit (go (sh/exit-code proc))
[result ch] (alts!! [cancel exit])]
(go (if (= ch cancel)
(do
(sh/destroy proc)
:cancelled)
(if (zero? result) :success :failure)))))