Skip to content

Instantly share code, notes, and snippets.

View ianfoo's full-sized avatar
💭
staring into the sun ☀️

Ian Molee ianfoo

💭
staring into the sun ☀️
  • Seattle WA
View GitHub Profile
@ianfoo
ianfoo / all-files.txt
Last active June 9, 2021 04:43
Cheap-ass filepath.WalkDir example
.
./all-files.txt
./sub1
./sub1/foo.toml
./sub1/foo.json
./sub1/bar.json
./sub1/foo.yaml
./sub1/sub2
./sub1/sub2/foo.blarg
./sub1/sub2/blarg.yamllllll
@ianfoo
ianfoo / 001-escaped-py2.2s.py
Last active March 10, 2021 07:42
Decode ISO-8859 encoded text to UTF-8
#! /usr/bin/env python2
# <bitbar.title>Escaped-Py2</bitbar.title>
# <bitbar.version>v0.0.1</bitbar.version>
# <bitbar.author.github>ianfoo</bitbar.author.github>
# <bitbar.desc>Echo escaped chars to stdout</bitbar.desc>
print("py2: :zzz: P\xe5 tide \xe5 logge av")
@ianfoo
ianfoo / dump.log
Created March 5, 2021 02:26
Crash when running xbar on other machine
$ xbar-install/xbar-main/app/build/darwin/desktop/xbar ; exit;
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x44 pc=0x7fff68704e05]
runtime stack:
runtime.throw(0x44ba531, 0x2a)
/usr/local/go/src/runtime/panic.go:1117 +0x72
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:718 +0x2ef
@ianfoo
ianfoo / xbar-setup.sh
Created March 5, 2021 00:45
Set up xbar dev env and build/run xbar
#!/usr/bin/env bash
set -eEuo pipefail
# Prep source code
unzip xbar-main.zip
git clone https://github.com/wailsapp/wails.git
# Install lastest wails prerelease
cd wails
@ianfoo
ianfoo / go-get-latest
Last active February 22, 2021 22:12
Get the latest version of Go from golang.org for macOS (tested on amd64)
#!/usr/bin/env bash
#
# Drop this in your path and make it executable to install the latest
# macOS version of Go from golang.org/dl.
set -Eeuo pipefail
go-get-latest-version-httpie () {
http -F golang.org/VERSION m==text
}
@ianfoo
ianfoo / batch.go
Last active January 21, 2020 05:46
Paginating fetcher against stubbed service
package main
import (
"io"
"math/rand"
"time"
"github.com/sirupsen/logrus"
)
@ianfoo
ianfoo / console.log
Last active November 10, 2019 10:34
Simple Go HTTP server with write timeout
ianbook%
ianbook% http -h :3030 s==50
HTTP/1.1 200 OK
Content-Length: 0
Date: Sun, 10 Nov 2019 10:33:32 GMT
ianbook% http -h :3030 s==200
http: error: ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) while doing GET request to URL: http://localhost:3030/?s=200
ianbook% http -h :3030 s==20
@ianfoo
ianfoo / config-del.yaml
Last active November 2, 2019 01:49
Deleting a setting in Viper (any config type)
bobjects:
limit: 100
foo:
blatz: quux
@ianfoo
ianfoo / config-del.hcl
Last active November 1, 2019 17:54
Deleting a setting in Viper
"bobjects" = {
"limit" = 100
}
"foo" = {
"blatz" = "quux"
}
@ianfoo
ianfoo / start-minikube.sh
Created October 8, 2019 23:43
Enabling APIs deprecated in Kubernetes 1.16 from Minikube start invocation
minikube start --extra-config=apiserver.runtime-config=apps/v1beta1=true,apps/v1beta2=true,extensions/v1beta1/daemonsets=true,extensions/v1beta1/deployments=true,extensions/v1beta1/replicasets=true,extensions/v1beta1/networkpolicies=true,extensions/v1beta1/podsecuritypolicies=true