Skip to content

Instantly share code, notes, and snippets.

@rkoopmann
rkoopmann / add-missing-events.sh
Last active April 26, 2024 21:24
my Jekyll scripts
#!/bin/bash
cd ../_events/
dateList=$(jq -r '.[] | .[] | [.Date] | @tsv' ../_data/events/list.json | sort -u)
echo "Looking for missing event files."
for d in ${dateList}; do
y=$(echo "${d}" | cut -d- -f1)
@rkoopmann
rkoopmann / sketch-share-solve-answers.sh
Last active March 4, 2024 18:56
sketch-share-solve-answers
#!/bin/bash
# determine which version you're working with, then uncomment the corresponding commit id
versionCommit="9ac64f8c52129970034e636296810db10283c988" # v1.0.0 2022-02-28
#versionCommit="e660070cd210d8ad81fc5679a1782b197e573ec3" # v1.1.0 2022-03-12
#versionCommit="fa8e0c20ef5d24ab5d8ed66c53088c0443940b4e" # v1.1.1 2022-04-29
#versionCommit="dff1b0e7f6274b6d69c99eb3d7ca45b272d5f88b" # v1.2.0 2022-05-21
#versionCommit="fb75f6a73af2571f2db4692a60c2d8f492a75410" # v1.2.1 2022-05-31
#versionCommit="7d73f2a282d7ad7a076f4a15ef8212e41e2820cd" # v1.4.0 2022-12-22
#versionCommit="5ae7cc8232895e417d71dfe95d79e8c7af167f28" # v2.0.0 2023-01-22
@rkoopmann
rkoopmann / get-bigquery-view-source.sh
Created February 21, 2022 21:12
iterate over all views in all datasets and saving source to a local sql files
#!/bin/bash
dataset_list="$(bq ls -n 500 | awk '{print $1}')"
for dataset in ${dataset_list}; do
view_list="$(bq ls --dataset_id ${dataset} -n 500 | awk '{if($2 == "VIEW"){print $1}}')"
for view in ${view_list}; do
echo "${dataset}.${view}"
@rkoopmann
rkoopmann / tinydesk.sh
Created February 21, 2022 21:02
scraping NPR's tiny desk concert archives
#!/bin/bash
rm -f ~/dev/tiny-desk-concerts.txt
for y in {2008..2021}; do
echo "${y}"
for m in {1..12}; do
echo "${m}"
curl -s "https://www.npr.org/series/tiny-desk-concerts/archive?date=${m}-31-${y}" \
| htmlq 'h2.title' >> ~/dev/tiny-desk-concerts.txt
@rkoopmann
rkoopmann / parse_yaml.sh
Created January 14, 2021 21:11 — forked from pkuczynski/parse_yaml.sh
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@rkoopmann
rkoopmann / split-file.sh
Last active February 28, 2020 16:34
a file-splitting script
#!/bin/bash
# split-file.sh
# a file-splitting script.
#
# take a delimited file, choose a column suitable for splitting by value, split the file into sub-
# directories (named after cplitting column and split value).
#
# limitations
# - header record cannot contain spaces

Keybase proof

I hereby claim:

  • I am rkoopmann on github.
  • I am rkoopmann (https://keybase.io/rkoopmann) on keybase.
  • I have a public key ASDOyxVKOafjf2mEUNRpf986Gla_Vj_yqzt_03E25NpTfAo

To claim this, I am signing this object:

#!/usr/local/bin/zsh
osascript \
-e 'tell application "Notes" to activate' \
-e 'delay 1'
for f in $@*.html
do
filename=$(basename "$f")
extension="${filename##*.}"
@rkoopmann
rkoopmann / client.sas
Created April 10, 2015 03:15
A little snippet for creating a bat file to provide a titlebar name for SAS
%let location=%sysget(sasroot)\sas.exe ;
%let config=%sysfunc(getoption(CONFIG));
%let client=;
*&TRN is a full path for a given client directory. it is standard structure for ALL clients.;
data _null_;
re=prxparse('/.*Clients\\(.+?)\\.*/');
if prxmatch(re, "&TRN") then do;
client=prxposn(re, 1, "&TRN");
put client;
@rkoopmann
rkoopmann / correspondence_threadArcs.plist
Created March 27, 2015 13:47
Custom MailMate mailbox view combining the correspondence view with the thread arcs view.
{
name = "Correspondence & Thread Arcs";
rootViewer =
{
viewerType = "MmSplitView";
orientation = "horizontal";
children =
(
{
viewerType = "MmBoxView";