Skip to content

Instantly share code, notes, and snippets.

@atomlab
atomlab / script-with-options.sh
Created August 19, 2023 05:27 — forked from dgoguerra/script-with-options.sh
Manual alternative to getopt in bash scripts, supporting short and long options
#!/usr/bin/env bash
# File name
readonly PROGNAME=$(basename $0)
# File name, without the extension
readonly PROGBASENAME=${PROGNAME%.*}
# File directory
readonly PROGDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# Arguments
readonly ARGS="$@"
@atomlab
atomlab / install_zsh.sh
Created June 16, 2023 10:44 — forked from ZhaofengWu/install_zsh.sh
Install zsh without root
#!/bin/bash
set -e
# zsh will not install without ncurses. If the machine doesn't have this library, it will need to be installed first.
export CXXFLAGS=" -fPIC" CFLAGS=" -fPIC" CPPFLAGS="-I${HOME}/include" LDFLAGS="-L${HOME}/lib"
wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.2.tar.gz
tar -xzvf ncurses-6.2.tar.gz
cd ncurses-6.2
./configure --prefix=$HOME --enable-shared
@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

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 / 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 / bash.generate.random.alphanumeric.string.sh
Created October 20, 2015 13:37 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@atomlab
atomlab / genpassword
Created October 20, 2015 10:01 — forked from romaonthego/genpassword
Bash script: genpassword
#!/bin/bash
charspool=('a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p'
'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z' '0' '1' '2' '3' '4' '5' '6' '7'
'8' '9' '0' 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O'
'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z' '-' '_');
len=${#charspool[*]}
if [ $# -lt 1 ]; then
@atomlab
atomlab / Dockerfile
Last active August 29, 2015 14:26 — forked from konklone/Dockerfile
Dockerfile for installing Ruby 2.0 and RVM
FROM ubuntu
MAINTAINER Eric Mill "eric@konklone.com"
# turn on universe packages
RUN echo "deb http://archive.ubuntu.com/ubuntu raring main universe" > /etc/apt/sources.list
RUN apt-get update
# basics
RUN apt-get install -y nginx openssh-server git-core openssh-client curl
RUN apt-get install -y nano