Skip to content

Instantly share code, notes, and snippets.

xificurC / harpoons.core.cljc
Last active Jul 4, 2019
harpoons - clojure threading macros
View harpoons.core.cljc
;; from
(ns harpoons.core
#?(:cljs (:require-macros harpoons.core)))
(defmacro non-nil
"Return the leftmost non-nil value.
The evaluation is short-circuiting and each form is evaluated at most once.
xificurC / clojure-specter-benchmarks
Last active Dec 18, 2018
Clojure specter benchmarks done with criterium benchmarking library
View clojure-specter-benchmarks
Leiningen 2.8.1 on Java 1.8.0_181 OpenJDK 64-Bit Server VM
([org.clojure/clojure "1.9.0"] [criterium/criterium "0.4.4"]),
:jvm-opts nil,
:eval-in nil}
Benchmark: get value in nested map
Mean(us) vs best Code
View git-updater.factor
#!/usr/bin/env factor-vm
USING: kernel io namespaces sequences io.launcher io.directories io.encodings.utf8 io.files io.pathnames concurrency.messaging threads math tools.threads accessors calendar ;
IN: script
: git-clean? ( path -- t/f )
[ "git status --untracked-files=no --porcelain" utf8 [ read1 not ]
with-process-reader* ] with-directory nip 0 = and ;
: git-pull ( path -- )
View gist:308017c850de3b041c3deea5cfe2d995
root@4e7f2ed9b46c:/tmp/hadoop-2.7.2# bin/hadoop checknative -a
16/05/12 12:51:03 WARN bzip2.Bzip2Factory: Failed to load/initialize native-bzip2 library system-native, will use pure-Java version
16/05/12 12:51:03 INFO zlib.ZlibFactory: Successfully loaded & initialized native-zlib library
Native library checking:
hadoop: true /tmp/hadoop-2.7.2/lib/native/
zlib: true /lib/x86_64-linux-gnu/
snappy: true /usr/lib/
lz4: true revision:99
bzip2: false
openssl: false Cannot load ( cannot open shared object file: No such file or directory)!
View gist:db8224ea5e8bf252024a
/ # update-ca-certificates
/etc/ca-certificates/update.d/c_rehash: exec: line 2: /usr/bin/c_rehash: not found
run-parts: /etc/ca-certificates/update.d/c_rehash: exit status 2
local files=("file one" "file two")
touch "${files[@]}"
bash -c "rm ??"
View comobjects.ps1
function dataRange {
param ($rngFirst)
$rngAll = $rngFirst.CurrentRegion
$rngData = $rngAll.Offset(1,0).Resize($rngAll.Rows.Count)
return $rngData
dataRange($ws.Range("A1")) # loads as Boolean
textual: complement charset "<"
test: {
<div class="tmi-group ">
<div class="tmi tmi-daily bold ">
<div class="tmi-text-group">
<div class="tmi-name">
text here
<span class="tmi-qty">0,2l </span>
more text here.
xificurC / gist:34535c6c2d4a9d0c4f7a
Last active Nov 3, 2015
spacemacs prompt for kill-emacs
View gist:34535c6c2d4a9d0c4f7a
(advice-remove 'kill-emacs 'spacemacs-really-exit)
(defun ad-advice-kill-emacs (orig-fun)
"Prompt before killing."
(if (and (not spacemacs-really-kill-emacs)
(when (y-or-n-p "Really kill frame?")
(when (y-or-n-p "Really exit?")
(funcall orig-fun))))
(advice-add 'kill-emacs :around 'ad-advice-kill-emacs)