Skip to content

Instantly share code, notes, and snippets.

@imylomylo
imylomylo / gist:0a5936e88ed8bbf6220005f3e39e37fc
Created October 23, 2018 10:20
Docker komodo from emmanuel dragon riders
Discord #developer channel
FROM ubuntu:16.04
ENV BUILD_PACKAGES="build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev curl wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqt4-dev libqrencode-dev libdb++-dev"
RUN apt update && \
apt install -y $BUILD_PACKAGES
Setting up a table
#############
https://github.com/smk762/kmd_pulp/blob/master/Staked/dice/dice_table.sh#L176
We can see here that to setup a table we use the `dicefund` command which gives us a `rawtransaction` to broadcast on the network at https://github.com/smk762/kmd_pulp/blob/master/Staked/dice/dice_table.sh#L180
We go into a loop to check that the `dicefund` (table setup) transaction has been confirmed https://github.com/smk762/kmd_pulp/blob/master/Staked/dice/dice_table.sh#L191
When confirmed, doing a `dicelist` gives us a list of tables https://github.com/smk762/kmd_pulp/blob/master/Staked/dice/dice_table.sh#L195
https://medium.com/@nickdenardis/working-with-vuepress-v0-10-and-tailwind-css-v0-6-f9a928fbae98
@imylomylo
imylomylo / gist:7e2fc21c855b130b4c28ef095d208f16
Last active December 5, 2018 09:11
rate limit bad miners
-N BADMINER creates a new iptables chain called "BADMINER"
-A INPUT appends to the "INPUT" chain this rule, which searches for the string "authorize" on tcp/4646 and then jumps (-j) to the rules of chain BADMINER (-j BADMINER)
-A BADMINER has the rate limit of 10/min and logs to syslog
iptables -N BADMINER
iptables -A BADMINER -m limit --limit 10/min -j LOG --log-prefix "BADMINER DROP: "
iptables -A BADMINER -m comment --comment "Rate limit exceeded, reject" -j REJECT
iptables -A INPUT -i eth0 -p tcp -m tcp --dport 4646 -m string --string "authorize" --algo bm -m comment --comment "Catch BADMINER" -j BADMINER
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
komodod -regtest -ac_name=REGTESTKMDICE -pubkey=03511aab41ccdef8586a79460765c1f260b6082a52772dfb80054ba17c74652f81 -ac_cc=2 -ac_supply=5000
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
sudo systemctl restart apache2
<VirtualHost *:443>
SSLEngine on
RequestHeader set X-Forwarded-Proto 'https'
docker exec -it mediawiki /bin/bash
# Disable reading by anonymous users
$wgGroupPermissions['*']['read'] = false;
# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;
# Prevent new user registrations except by sysops
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install python-certbot-apache
certbot --apache -d example.com -d www.example.com
certbot renew --dry-run
Need to check out
https://medium.com/@richardkall/setup-lets-encrypt-ssl-certificate-on-amazon-cloudfront-b217669987b2
@imylomylo
imylomylo / gist:1011ca329621ce1c4b86cbc3e0de7ac5
Last active March 8, 2019 05:59
Iguana restart terminates unexpectedly from script (hypothesis)
#############
ENV different
#############
My cron restarts iguana like this:
13 0 * * 1 . $HOME/.profile;/home/me/cron_rotate.sh 2>&1
The `. $HOME/.profile` is needed because the cron ENV is not the same as the logged in user ENV.
##########################