Skip to content

Instantly share code, notes, and snippets.

View arussellsaw's full-sized avatar
open for work!

Alex Russell-Saw arussellsaw

open for work!
View GitHub Profile
for palette in $(ls palettes/)
echo $palette
for file in $(ls |grep -v palette |grep -v .sh)
echo $file
convert $file \
-resize 400x \
arussellsaw / gorm_tracing.go
Created June 27, 2022 14:51
the google cloud tracing setup for Gorm at
package trace
import (
pg_query ""
arussellsaw /
Created January 28, 2021 12:02
go test your diff with emoji
echo "⏱ pre-commit tests"
STAGED_GO_FILES=$(git diff HEAD --name-only -- '*.go')
> /tmp/testdirs
for file in $STAGED_GO_FILES; do
dir=$(dirname "$file")
echo "./$dir" >> /tmp/testdirs
arussellsaw / broken-search.go
Created December 13, 2020 11:53
broken search doc
var docStr = "英欧贸易谈判进入最后时刻 双方警告目前不太可能达成协议1小时前分享至当地时间13日,据多家英媒报道称,英欧贸易谈判已进入最后时刻,12日的谈判一直持续到深夜,双方希望谈判可以取得一定的突破以打破目前的僵局。但英国和欧盟双方最后都警告称,目前还不太可能达成协议。一位英国政府消息人士表示,欧盟方面给出的协议条款仍然是英国“无法接受的”。(央视新闻)下一篇中金:年底市场风险偏好可能偏弱12月13日讯,中金策略今日晚间发布公告称,临近年底市场风险偏好可能偏弱,投资者在市场的变化中稳守基本面与估值底线,注重低估值、有正面催化等因素,逢低吸纳符合产业升级与消费升级主线的优质成长个股。关注新能源汽车产业链中上游及原材料如锂;低吸部分疫情受损、当前在复苏的板块,如酒店等。中长期逢低吸纳反应消费升级与产业升级趋势的优质龙头。(财联社)1小时前"
var docTitle = "英欧贸易谈判进入最后时刻 双方警告目前不太可能达成协议"
_, err = indexService.PutDoc(ctx, firesearch.PutDocRequest{
IndexPath: "news/search/articles",
Doc: firesearch.Doc{
ID: a.ID,
SearchFields: []firesearch.SearchField{
Key: "title",
arussellsaw /
Last active December 26, 2023 21:47
Monzo Plus Grafana Dashboard

Monzo Plus Grafana Dashboard

Now that Monzo Plus is out, i thought i'd share how i've set up my personal budgeting dashboards using the Google Sheets export that i showed off in this tweet:

A quick note on cost, bigquery isn't free, but even with my Monzo transaction history, which i've had since 2016 (although the google sheets only goes as far as the prepaid->current account migration) the volume of data here is still so low that bigquery doesn't even appear on my GCP billing, as we're well below the 1tb billing threshold. That being said if you somehow misconfigure things, it's possible that you could incur billing costs, so it's worth being wary of that.

The sheets export automatically creates and updates a google sheet with each transaction, and luckily google BigQuery supports using a google sheet as an external table, so we can just query the sheet directly, and have it updated as new rows are add

arussellsaw /
Created April 16, 2020 10:27
A script to poll Shipton Mill's queue page and notify you when slots appear, notifications work on MacOS
base=$(curl -s |grep -i -A 10 '<h3>request a delivery slot')
while true; do
res=$(curl -s |grep -i -A 10 '<h3>request a delivery slot')
echo "poll..."
if [ "$base" != "$res" ]; then
echo $res
osascript -e 'display notification "ARE YOU BREADY FOR THIS?"'
type mutexMap struct {
someMap map[string]int
lock sync.Mutex
func main() {
defer mutexMap.lock.Unlock()
mutexMap.someMap["herp"] = "derp"
arussellsaw / limitation match
Created July 1, 2015 15:59
matching limitations UDF
local function map_results(record)
info("MAP ROW")
return map {agency_key=record.agency_key,campaign_key=record.campaign_key,zone_key=record.zone_key,server=record.server,a_id=record.a_id,win_c_id=record.win_c_id,win_c_type=record.win_c_type,z_id=record.z_id,geo_c_code=record.geo_c_code,dev_limit=record.dev_limit,pp=record.pp,vol=record.vol}
function match(stream, slimitation)
JSON = require("JSON")
local debugvar
arussellsaw /
Created June 16, 2015 20:11
Android Fragments not being fragments?
class MarkerDetails extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.marker_details, container, false);
class SomeActivity extends FragmentActivity {
public void newMarker(View view) {
FragmentManager fragmentManager = getFragmentManager();