Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -u
# ----------------------------------------------------------
# Helpers
function html() {
contents="none"
case $1 in
ok)
#!/bin/bash
set -euo pipefail
readonly dot_file="$1"
readonly output_file="$2"
readonly dot_file_abs=$(readlink -f $dot_file)
if [ ! -f $dot_file_abs ]
then
@raghavkarol
raghavkarol / watch_reload_chrome_tab
Created January 15, 2019 14:13
reload_active_tab_chrome.as wrapped to use python watchdog
#!/bin/bash
patterns="$1"
url="$2"
echo "$(date) start watch reloading for $url on change to $patterns"
watchmedo shell-command --patterns "${patterns}" --command "echo \$(date) \$watch_src_path changed; reload_active_tab_chrome.as '$url'"
@raghavkarol
raghavkarol / erl_pprint
Created July 3, 2015 10:04
Pretty print an Erlang term read from standard input
#!/usr/bin/env escript
-export([main/1]).
-define(FUNC(F), fun(I) -> F(I) end). % Can't use fun quote_pids/1 in escript :(
to_erlang_term(Bin) ->
{ok, Scanned, _} = erl_scan:string(binary_to_list(Bin)),
{ok, Parsed} = erl_parse:parse_exprs(Scanned),
{value, Evaled, []} = erl_eval:exprs(Parsed, []),
@raghavkarol
raghavkarol / reload_active_tab_chrome.as
Last active January 15, 2019 14:12
Applescript to reload an active tab in crome
#!/usr/bin/osascript
-- -*- applescript -*-
on run argv
set reload_url_pattern to argv
tell application "Google Chrome"
set windowList to every window
repeat with aWindow in windowList