Skip to content

Instantly share code, notes, and snippets.

Avatar
👃
Smelling code smells

Alex Russell-Saw arussellsaw

👃
Smelling code smells
View GitHub Profile
View broken-search.go
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
arussellsaw / README.md
Last active Jul 19, 2020
Monzo Plus Grafana Dashboard
View README.md

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: https://twitter.com/arussellsaw/status/1283876210750230530?s=20

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
arussellsaw / shipton-poll.sh
Created Apr 16, 2020
A script to poll Shipton Mill's queue page and notify you when slots appear, notifications work on MacOS
View shipton-poll.sh
#!/bin/bash
base=$(curl -s https://www.shipton-mill.com/queue |grep -i -A 10 '<h3>request a delivery slot')
while true; do
res=$(curl -s https://www.shipton-mill.com/queue |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?"'
View mutex locked maps
type mutexMap struct {
someMap map[string]int
lock sync.Mutex
}
func main() {
mutexMap.lock.Lock()
defer mutexMap.lock.Unlock()
mutexMap.someMap["herp"] = "derp"
}
@arussellsaw
arussellsaw / limitation match
Created Jul 1, 2015
matching limitations UDF
View limitation match
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}
end
function match(stream, slimitation)
JSON = require("JSON")
local debugvar
@arussellsaw
arussellsaw / fragment.java
Created Jun 16, 2015
Android Fragments not being fragments?
View fragment.java
class MarkerDetails extends Fragment {
@Override
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();
You can’t perform that action at this time.