Skip to content

Instantly share code, notes, and snippets.

@exupero
exupero / cl.cljs
Last active April 26, 2018 18:42
Ad hoc text transformation via Planck
#!/usr/local/bin/planck
(require '[clojure.string :as string])
(require 'cljs.reader)
(require '[planck.core :refer [slurp eval *in* *command-line-args*]])
(def in (slurp *in*))
(defn format-output [x]
(cond
@exupero
exupero / clipboard.clj
Created September 22, 2017 18:32
Clojure code to interact with the system clipboard
(refer-clojure :exclude '[slurp spit])
(import '[java.awt.datatransfer DataFlavor StringSelection Transferable])
(defn clipboard []
(.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit)))
(defn slurp []
(try
(.getTransferData (.getContents (clipboard) nil) (DataFlavor/stringFlavor))
(catch java.lang.NullPointerException e nil)))
@exupero
exupero / README.md
Last active February 29, 2016 12:57
instruct

instruct

A shell script to give step-by-step instructions. Pipe text into it. It'll be processed as follows:

  • Each line is echoed back to you one at a time.
  • Hit the Enter key to see the next instruction.
  • Lines surrounded by triple backticks are copied to the system clipboard, and the next line of text has the icon next to it.
  • Blank lines are ignored.
  • To insert a blank line, use a triple dash (---).
@exupero
exupero / dnif.go
Created July 30, 2015 17:35
Find a file in an ancestory directory
package main
import (
"flag"
"fmt"
"log"
"os"
"strings"
)
@exupero
exupero / git-review
Last active August 29, 2015 14:18
git-review
#!/bin/bash
if [[ -n "$TMUX" ]]; then
tmux send "git diff --cached" C-m \; split-window -v \; send "git commit $* && exit" C-m
else
git commit $*
fi
@exupero
exupero / index.html
Last active December 30, 2015 08:38 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: #fcfcfa;
}
.stroke {
fill: none;
@exupero
exupero / README.md
Last active December 21, 2015 03:28 — forked from mbostock/.block
D3-raylabel plugin

Demonstrates the D3 ray-label plugin for labeling slices of pie and donut graphs based on the angle of each slice's centroid.

Label font sizes are scaled (within bounds) based on the size of the slice.

Plugin is hosted on Github.

@exupero
exupero / README.md
Last active December 20, 2015 19:58
Uncertain Future Projection

A line graph with a projected future that waves to indicate uncertainty in the projection.

#!/bin/bash
domain=$1
port=$2
if [ -z "$domain" ] || [ -z "$port" ]; then
echo "Usage: domain-alias <domain> <port>"
exit 1
fi
@exupero
exupero / whichpull.py
Last active January 13, 2016 16:25
Getting the pull request for a branch with Python and Jq.
import json
import sys
for p in json.load(sys.stdin):
if p['head']['ref'] == sys.argv[1]:
print p['html_url']