Skip to content

Instantly share code, notes, and snippets.

@EdwardPrentice
EdwardPrentice / install_docker.sh
Created April 23, 2018 18:38
Install Docker on Ubuntu
#!/bin/bash -eu
sudo apt-get update
echo "Installing docker"
sudo apt-get -y install apt-transport-https
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
@EdwardPrentice
EdwardPrentice / Vagrantfile
Created April 8, 2019 09:32
Automatically install required plugins used within a Vagrantfile
if ARGV[0] != 'plugin'
required_plugins = ['vagrant-vbguest', 'vagrant-reload']
plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin }
if not plugins_to_install.empty?
puts "Installing plugins: #{plugins_to_install.join(' ')}"
if system "vagrant plugin install #{plugins_to_install.join(' ')}"
exec "vagrant #{ARGV.join(' ')}"
else
abort "Installation of one or more plugins has failed. Aborting."
end
@EdwardPrentice
EdwardPrentice / teku.service
Last active October 10, 2021 20:54
Teku Service file
# For Ubuntu 20.04 install to /etc/systemd/system/teku.service
[Unit]
Description = eth2 teku service
Wants = network-online.target
After = network-online.target
[Service]
User = root
Environment ="JAVA_OPTS=-Xmx6g -XshowSettings:vm"
@EdwardPrentice
EdwardPrentice / manually_update_teku.sh
Created March 14, 2021 17:30
How I upgrade Teku on my Ethereum Validator
# Warning: This is a human script that needs to be used interatively.
# That said it wouldn't take much to improve it so it could all be done with a single invocation
# Download the new version and do a checksum check. Output check is manual
TEKU_VERSION="teku-21.2.0.tar.gz"; curl -s https://artifacts.consensys.net/public/teku/raw/names/teku.tar.gz/versions/21.2.0/$TEKU_VERSION -o $TEKU_VERSION && shasum -a 256 -c <<< "27aba84f4ac8678ebd7dea7d2e19790cad7d04b5faf9108ce331c2f8a9e2330f *$TEKU_VERSION" || (echo "Checksum failed deleting file" && rm $TEKU_VERSION); tar -xf $TEKU_VERSION -C /opt
# Create a symlink to the newly extracted teku version
ln -s /opt/teku-21.2.0/bin/teku /usr/bin/teku-21.2.0
# Edit the service file to point to the new symlink
#!/bin/bash -eu
if [[ $# -eq 0 ]] ; then
echo "No argument supplied"
exit 1
fi
gpgconf --reload gpg-agent
gpg --cipher-algo AES256 --symmetric $1
gpgconf --reload gpg-agent
#!/bin/bash -eu
if [[ $# -eq 0 ]] ; then
echo "No argument supplied"
exit 1
fi
gpgconf --reload gpg-agent # cleans out any failed attempts
gpg --decrypt $1
gpgconf --reload gpg-agent # forget the password immediately
@EdwardPrentice
EdwardPrentice / config.yml
Last active April 23, 2021 22:49
Teku config.yml
# full set of options can be found at https://docs.teku.consensys.net/en/latest/Reference/CLI/CLI-Syntax
# validators
validator-keys: "/root/keystore-m_123.json:/root/keystore-m_123.txt"
validators-graffiti: "edzorg"
# eth 1
eth1-endpoint: "http://localhost:6666"
# use the newest levelDB which uses less space
@EdwardPrentice
EdwardPrentice / eth1.conf
Last active March 20, 2022 16:26
Nginx config to route to multiple Eth1 providers
# turn off default logging
access_log off;
# Create our own format including $server_name
log_format main escape=none
#'$remote_addr - $remote_user '
'[$time_local] '
'$request $status '
#'"$http_user_agent" '
#'"$http_origin" '