Skip to content

Instantly share code, notes, and snippets.

View dmos62's full-sized avatar

Dominykas Mostauskis dmos62

View GitHub Profile
@dmos62
dmos62 / count_txs.sh
Last active September 2, 2022 14:12
Script for counting number of Postgres txs performed since starting the script
View count_txs.sh
#!/bin/sh
# Requires `psql`. The script effectively wraps a `psql` invocation.
# This is what I use for installing psql: `apt update && apt install postgresql-contrib -y`.
# Checks Postgres's tx counter, then blocks until ctrl-c is pressed, then checks tx counter again,
# prints difference, and exits. Start it before performing some database interactions, then press
# Ctrl-C to get the number of transaction commits that were performed since starting script.
#
# Should be called with the psql command as argument:
View tests.bats
#!/usr/bin/env bats
daoSetup_localFile="dao-setup.zip"
download-dao-setup-if-needed() {
local daoSetup_remoteUrl="https://github.com/bisq-network/bisq/raw/master/docs/dao-setup.zip"
test ! -f $daoSetup_localFile \
&& wget -O $daoSetup_localFile $daoSetup_remoteUrl
}
View DecidePeerSourcing.tla
vim: shiftwidth=2
---- MODULE DecidePeerSourcing ----
UNDEFINED == ""
\* BaseCurrencyNetwork
NetParams(btcMode) ==
CASE btcMode = "BTC_MAINNET" -> "MainNetParams"
[] btcMode = "BTC_TESTNET" -> "TestNet3Params"
[] btcMode = "BTC_REGTEST" -> "RegTestParams"
View gist:222b1344d758fdec2ee24145c1ac7ccb
### Keybase proof
I hereby claim:
* I am dmos62 on github.
* I am dmos (https://keybase.io/dmos) on keybase.
* I have a public key ASAsoUMlnE8qzbYFGGZIGH8EL4jmw1ooqQKp7C25nIaFvAo
To claim this, I am signing this object:
@dmos62
dmos62 / auto-patch.js
Created September 20, 2017 18:42
Patcher for Node.js that uses hashes to not patch twice
View auto-patch.js
/*
Usage looks like this:
```
$ node auto-patch.js get \
--original node_modules/epub.js/build/epub.js \
--changed epubjs.changed > patches/epubjs.patch
$ node auto-patch.js apply patches/epubjs.patch
```