Skip to content

Instantly share code, notes, and snippets.

Enum.filter(list, fn(room) -> room.guest == nil end)
|> (fn(list) -> if Enum.empty?(list), do: [nil], else: list end).()
|> Enum.random()
@droptheplot
droptheplot / codesign_gdb.md
Created December 17, 2017 15:04 — forked from hlissner/codesign_gdb.md
Codesign gdb on OSX

Note: these instructions are for pre-Sierra MacOS. Sierra Users: see https://gist.github.com/gravitylow/fb595186ce6068537a6e9da6d8b5b96d by @gravitylow.

If you are getting this in gdb on OSX while trying to run a program:

Unable to find Mach task port for process-id 57573: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
  1. Open Keychain Access
@droptheplot
droptheplot / iterm_nvim.AppleScript
Created February 26, 2018 14:55 — forked from sdkks/iterm_nvim.AppleScript
Open File with iTerm2 + nvim on MAC OSX Sierra
on run {input, parameters}
-- If run without input, open random file at $HOME
try
set filename to POSIX path of input
on error
set filename to "nvim-" & (do shell script "date +%F") & "__" & (random number from 1000 to 9999) & ".txt"
end try
-- Set your editor here
set myEditor to "/usr/local/bin/nvim"
-- Open the file and auto exit after done
sbt -sbt-version 1.2.7
[info] Loading settings for project global-plugins from plugin.sbt ...
[info] Loading global plugins from ~/.sbt/1.0/plugins
[info] Updating ProjectRef(uri("file:~/.sbt/1.0/plugins/"), "global-plugins")...
[info] Done updating.
[info] Loading settings for project recfun-build from plugins.sbt,buildSettings.sbt ...
[info] Loading project definition from ~/Projects/Coursera/recfun/project
[info] Updating ProjectRef(uri("file:~/Projects/Coursera/recfun/project/"), "recfun-build")...
[info] Done updating.
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
mv.visitTypeInsn(NEW, "java/util/Stack")
mv.visitInsn(DUP)
mv.visitMethodInsn(
  INVOKESPECIAL,
  "java/util/Stack",
  "<init>",
  "()V",
  false
)