Skip to content

Instantly share code, notes, and snippets.

View johnalotoski's full-sized avatar

John A. Lotoski johnalotoski

View GitHub Profile
@johnalotoski
johnalotoski / shell.nix
Created March 31, 2024 03:24
sha3sum nix shell
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-23.11.tar.gz") {}}:
let
sha3sum = pkgs.rustPlatform.buildRustPackage rec {
pname = "sha3sum";
version = "v1.2.0";
buildInputs = with pkgs; [ openssl ];
nativeBuildInputs = with pkgs; [ pkg-config ];
@johnalotoski
johnalotoski / try-reproducing-node-8.8.0-pre-truncation-failure.txt
Created February 12, 2024 03:11
Node 8.8.0-pre respin truncation test
# Show the final sanchonet node db sync directory of 8.7.3 state
# prior to 2024-02-10 respin in the host OS (nixos):
> ls
db-sanchonet-873-pristine
# Create an ubuntu 22.04 container and map the current directory
# containing the "db-sanchonet-873-pristine" 8.7.3 state prior to
# respin into the Ubuntu container's /host directory:
docker create -it -v $(pwd):/host --name truncater ubuntu:22.04
@johnalotoski
johnalotoski / postgres-cheatsheet.md
Created August 20, 2020 20:48 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@johnalotoski
johnalotoski / git-filter-branch-example.txt
Last active July 13, 2019 07:06
Git Filter Branch Example
# Example git filter-branch done during Hetzner repo migration prep:
$ git status
On branch nixops-hetzner-fb2
nothing to commit, working tree clean
# Find current number of commits
$ git rev-list --count nixops-hetzner-fb2
2836
@johnalotoski
johnalotoski / https-server.py
Created September 15, 2018 13:14
Python3 HTTPS Server
#!/usr/bin/env python3
# Ported to Python 3 by Telmo "Trooper" (telmo.trooper@gmail.com)
# https://gist.github.com/telmotrooper/84d8d4afbb294b599c6f443bbb36a456
#
# Original code from:
# http://www.piware.de/2011/01/creating-an-https-server-in-python/
# https://gist.github.com/dergachev/7028596
#
# To generate a certificate use:
@johnalotoski
johnalotoski / index.html
Last active September 15, 2018 18:36
Cardano-SL Explorer Sockets.io Basic Test
<!DOCTYPE html>
<html>
<head>
<title>Cardano-SL Explorer Sockets.io Basic Test</title>
</head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.1/socket.io.js"></script>
<script>
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}