Skip to content

Instantly share code, notes, and snippets.

View tbruyelle's full-sized avatar

Thomas Bruyelle tbruyelle

View GitHub Profile

$ATONE distribution (ratio: x0.170, nonVotersMultiplier: 0.975, icfSlash: 12,590,970 $ATOM)

TOTAL DID NOT VOTE YES NO NOWITHVETO ABSTAIN NOT STAKED
Distributed 58,204,801 6,287,512 6,374,676 26,675,549 5,988,892 3,414,384 9,463,788
Percentage over total 11% 11% 46% 10% 6% 16%
@tbruyelle
tbruyelle / .gitconfig
Last active May 11, 2022 12:14
useful scripts
[sendemail]
smtpserver = smtp.gmail.com
smtpuser = xxxx
smtpencryption = tls
smtpserverport = 587
smtpPass = xxxx
[user]
email = thomas.bruyelle@tendermint.com
name = Thomas Bruyelle
[alias]
@tbruyelle
tbruyelle / db.go
Last active October 23, 2020 08:23
pg batch insert
// usage :
batchInsert(ctx, db,
`INSERT INTO table (...) VALUES`, // the query without the row values
`($%[1]d, $%[2]d, ...)`, // a row value with parametized placeholders
16, // the number of values in a single row
values, // all the values (which can be larger than 65535)
)
package main
import (
"fmt"
"log"
"net/http"
"time"
)
@tbruyelle
tbruyelle / Makefile
Created June 13, 2017 08:05
a go MakeFile
APP = ???
PACKAGE = github.com/???/???
BIN = $(PACKAGE)/cmd/???
TARGET = `go list $(PACKAGE)/... | grep -v vendor`
SRC_DIR = ???
default: build
include checks.mk
checks:
go test -race $(TARGET)
@$(call checkbin,go tool vet,golang.org/x/tools/cms/vet)
go tool vet $(SRC_DIR)
@$(call checkbin,golint,github.com/golang/lint/golint)
golint -set_exit_status $(SRC_DIR)
@$(call checkbin,errcheck,github.com/kisielk/errcheck)
errcheck -ignore 'Close' -ignoretests $(TARGET)
@$(call checkbin,structcheck,github.com/opennota/check/cmd/structcheck)
structcheck $(TARGET)
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/md5"
"encoding/base64"
"fmt"
)
ln -sf /usr/lib/libstdc++.so.6 ~/Android/Sdk/tools/lib64/libstdc++/libstdc++.so.6
.debounce(100)
.filter(val -> {
if (allKeys[val]) {
allKeys[val] = false;
return true;
}
return false;
})
public View getViewByPosition(int pos, ListView listView) {
final int firstListItemPosition = listView.getFirstVisiblePosition();
final int lastListItemPosition = firstListItemPosition + listView.getChildCount() - 1;
if (pos < firstListItemPosition || pos > lastListItemPosition ) {
return listView.getAdapter().getView(pos, null, listView);
} else {
final int childIndex = pos - firstListItemPosition;
return listView.getChildAt(childIndex);
}