Skip to content

Instantly share code, notes, and snippets.

@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 April 10, 2024 14:45
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",
@atomlab
atomlab / pubkey_to_addr.go
Created May 8, 2020 13:05 — forked from davecgh/pubkey_to_addr.go
Example of converting a raw public key to a btcutil.Address.
package main
import (
"fmt"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil"
)
func main() {
@atomlab
atomlab / clean_prometheus_data.md
Last active February 18, 2024 08:56
Delete data from Prometheus

starting the server with the option

--web.enable-admin-api

Prometheus

# delete alerts series
curl -v -X POST -g 'http://localhost:9090/api/v2/admin/tsdb/delete_series?match[]=ALERTS'
@atomlab
atomlab / config.md
Created March 17, 2020 22:50
How can I match a CIDR range for an SSH config host entry?
all hosts matching 10.2.?.* (i.e. 10.2.0.0–10.2.9.255)
all hosts matching 10.2.??.* (i.e. 10.2.10.0–10.2.99.255)
all hosts matching 10.2.10?.* (i.e. 10.2.100.0–10.2.109.255)
all hosts matching 10.2.11?.* (i.e. 10.2.110.0–10.2.119.255)
all hosts matching 10.2.12?.* EXCEPT the ones matching 10.2.128.* and 10.12.129.* (and remember that the exclusion must come first!)

Example ~/.ssh/config

@atomlab
atomlab / forbidden-12-index-read-only-allow-delete-api.md
Last active March 9, 2020 12:04
[ELASTIC] FORBIDDEN/12/index read-only / allow delete (api)]
PUT _settings
    {
    "index": {
    "blocks": {
    "read_only_allow_delete": "false"
    }
    }
    }