Skip to content

Instantly share code, notes, and snippets.

@scgilardi
scgilardi / asdf-update-all.sh
Created January 6, 2022 14:53
Script to install "latest" (or other "desired") version of all asdf plugins and make them "current"
#!/usr/bin/env bash
# adapted from:
# https://gist.github.com/developer-guy/4de4e2ff2eaa31633a0fef719c92eada
# 2021-12-18
function update() {
asdf update > /dev/null 2>&1
echo asdf `asdf --version`
for i in `asdf plugin list`; do
@scgilardi
scgilardi / lazy-vs-eager.cljs
Last active February 15, 2020 14:24
compares lazy vs. eager, into+transducer vs. doall
(ns keechma-todomvc.components.todo-list
"# Todo List component"
(:require [keechma-todomvc.ui :refer [<comp comp> route> sub>]]))
(defn render
"## Renders a list of currently visible todos
`todo` visiblity is controlled by the current `route`.
### Component Deps
@scgilardi
scgilardi / core.clj
Last active September 29, 2015 20:34
more update-in benchmark options
(ns bench-update.core
(:use [criterium.core]))
;; (bench-update (update {:a 1} :a inc)) [128 ns]
;; (bench-update (update-in {:a 1} [:a] inc)) [349 ns] [100%]
;; (bench-update (update-in' {:a 1} [:a] inc)) [209 ns] [ 60%]
;; (bench-update (update {:a 1} :a + 1)) [56 ns]
;; (bench-update (update-in {:a 1} [:a] + 1)) [495 ns] [100%]
;; (bench-update (update-in' {:a 1} [:a] + 1)) [217 ns] [ 44%]
firefly-vm:~/src/pixie% make lib
echo https://github.com/pixie-lang/external-deps/releases/download/1.0/`uname -s`-`uname -m`.tar.bz2
https://github.com/pixie-lang/external-deps/releases/download/1.0/Linux-x86_64.tar.bz2
curl -L https://github.com/pixie-lang/external-deps/releases/download/1.0/`uname -s`-`uname -m`.tar.bz2 > /tmp/externals.tar.bz2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 398 0 398 0 0 70 0 --:--:-- 0:00:05 --:--:-- 95
0 0 0 1435 0 0 126 0 --:--:-- 0:00:11 --:--:-- 457
tar -jxf /tmp/externals.tar.bz2 --strip-components=2
bzip2: (stdin) is not a bzip2 file.
@scgilardi
scgilardi / gist:0e3304595048f4ce18ea
Created August 22, 2014 15:55
Files to remove to really uninstall PanaCast Camera
/Applications/PanaCast.app
/Library/CoreMediaIO/Plug-Ins/DAL/AltiaSystemsPanaCastCamera.plugin
/Library/QuickTime/AltiaSystemsPanaCastCamera.component
(defun use-project-relative-nrepl-history-file ()
(setq nrepl-history-file
(concat
(locate-dominating-file (nrepl-current-dir) "project.clj")
".nrepl-history")))
(add-hook 'nrepl-interaction-mode-hook 'use-project-relative-nrepl-history-file)
@scgilardi
scgilardi / visible-let.clj
Created November 16, 2011 16:09
a variant of let that provides access to all the bindings
; works in a simple test case, hasn't seen any other testing
(defmacro environment
"Expands to code that generates a map of locals: names to values"
[]
`(zipmap '~(keys &env) [~@(keys &env)]))
(defmacro visible-let [argv & body]
`(let [~@ argv
~'&bindings (environment)]
@scgilardi
scgilardi / environment.plist
Created May 25, 2011 00:42
example for .MacOSX/environment.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PATH</key>
<string>/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/X11/bin</string>
</dict>
</plist>
# improved version of the code in Eivind Uggedal's comment at
# http://justinchouinard.com/blog/2010/04/10/fix-stale-ssh-environment-variables-in-gnu-screen-and-tmux/
function preexec() {
if [[ -n $TMUX ]]; then
TMUX_SOCK=$(echo $TMUX|cut -d , -f 1)
NEW_SSH_AUTH_SOCK=$(tmux -S $TMUX_SOCK showenv|grep ^SSH_AUTH_SOCK|cut -d = -f 2)
if [[ -n $NEW_SSH_AUTH_SOCK ]] && [[ -S $NEW_SSH_AUTH_SOCK ]]; then
SSH_AUTH_SOCK=$NEW_SSH_AUTH_SOCK
fi