Skip to content

Instantly share code, notes, and snippets.

@atomlab
atomlab / bash_strict_mode.md
Created September 4, 2021 18:57 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -x, -o pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@atomlab
atomlab / ferm.conf
Created January 28, 2021 17:53
Default ferm conf
def $TRUSTED = (
);
domain (ip) {
table filter {
chain INPUT {
policy DROP;
# connection tracking
mod state state INVALID DROP;
mod state state (ESTABLISHED RELATED) ACCEPT;
@atomlab
atomlab / docker_install.md
Last active January 15, 2021 09:31
Docker install

Docker install

Docker

curl -fsSL https://get.docker.com -o get-docker.sh
sh ./get-docker.sh

Docker-compose

@atomlab
atomlab / test.js
Last active January 7, 2021 21:32
// Switch current database to "history"
db = db.getSiblingDB('history');
// The mark for cutting initial output off
print("CUT_TO_HERE");
rs.slaveOk();
// Main output
// "toArray()" method allows to get all records
printjson( db.getCollection('LastWeekRates').find({coin: {$in:["AE", "ADA", "ARK", "BCD", "BCH", "BNB", "BSV", "BTC", "BTG", "DCR", "DGB", "EOS", "ETC", "ETH", "GAS", "GRS", "ICX", "KIN", "LTC", "NEO", "ONG", "ONT", "RVN", "TRX", "BTT","TRX-USDT", "WIN", "JST", "XLM", "XRP"]}, fiat: 'USD'}).toArray());

Baking on Tezos

This document describes how to setup a Tezos node and delegate baking rights to it. It involves configuring two instances:

  • Node: Public vps instance that interacts with the tezos network and runs tezos-node, tezos-baker, tezos-endorser and tezos-accuser.
  • Signer: Private instance on your home network that contains the baker keys and authorizes baking requests via tezos-signer.

Prep Instances

This guide assumes you have already created two instances running Ubuntu 18.04.

@atomlab
atomlab / docker_hub_make_repo.md
Created December 14, 2020 14:09
Create a private repository on Docker Hub using Docker Registry API Client

Api Documentation

TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${UNAME}'", "password": "'${UPASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)

curl -s -H "Authorization: JWT ${TOKEN}" "https://hub.docker.com/v2/repositories/" \
     --data 'description=test' \
     --data 'full_description=full-description' \
     --data 'is_private=false' \
 --data 'name=test' \
@atomlab
atomlab / siege_bench_post.sh
Created November 27, 2020 16:15
Siege Benchmark Post request
siege -c50 -b -t60S -H 'Content-Type: application/json' 'https://example.com/api POST {"id": "1", "jsonrpc": "2.0", "method": "GetBalance", "params":["..."]}'
@atomlab
atomlab / cardano_reg_pool_tx_build.sh
Last active November 19, 2020 17:21
Cardano pool registration tx build
#!/bin/bash
set -e
cardano-cli shelley query protocol-parameters \
--mainnet \
--out-file params.json
currentSlot=$(cardano-cli shelley query tip --mainnet | jq -r '.slotNo')
cardano-cli shelley query utxo --address $(cat payment.addr) --mainnet > fullUtxo.out
tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out
@atomlab
atomlab / cat_between_matches.md
Created July 12, 2020 06:57
print file content between match lines
sed -n '/Jul 11 16:40:00/,/Jul 11 17:10:00/p' /var/log/syslog
@atomlab
atomlab / guacamole_rest_api_examples.md
Last active March 28, 2025 12:57
Guacamole REST API Examples

Get token

curl -X POST -d 'username=MYUSERNAME&password=MYPASSWORD' http://localhost:8080/guacamole/api/tokens

output

{
  "authToken": "C90FE11682EE3A8CCA339F1135FF02D0A97CDDDE440A970B559D005517BE6EA8",
  "username": "guacadmin",