This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/planck | |
(ns deploy.core | |
(:require [cljs.reader :refer [read-string]] | |
[planck.shell :as shell])) | |
(defn sh [& args] | |
(let [result (apply shell/sh args)] | |
(if (= 0 (:exit result)) | |
(:out result) | |
(throw (ex-info (:err result) {}))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from timeit import default_timer | |
class MeasureTime(object): | |
""" | |
Easily measure the time of a Python code block. | |
>>> import time | |
>>> with MeasureTime() as m: | |
... time.sleep(1) | |
Elapsed time: 0 m and 1.00 s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
trap 'kill $(jobs -pr) 2>/dev/null' SIGINT SIGTERM EXIT | |
browser=chromium-browser | |
python3 -m http.server & | |
$browser "http://localhost:8000/$1" 2>/dev/null & | |
browserpid=$! |
OlderNewer