Skip to content

Instantly share code, notes, and snippets.

View Ernillew's full-sized avatar

Ergil Osin Ernillew

View GitHub Profile
@Ernillew
Ernillew / xmrig.service
Created September 23, 2017 02:10
systemd-unit for xmrig
[Unit]
Description=XMRig Daemon
After=network.target
[Service]
Type=forking
GuessMainPID=no
ExecStart=/usr/local/bin/xmrig -c /home/miner/config/config.json -l /home/miner/xmrig.log -B
Restart=always
User=miner
@Ernillew
Ernillew / install_monerod.bash
Last active November 3, 2021 03:49
Script for install monerod 0.11
#!/bin/bash
# Ergil Osin 2017
# Donate XMR 4FRyuEftwbeGToYJY6hcmTeFCEQufop63QDLPpabYcx9Ju78jqKdNvS99QNmWryLdobo1o7XocACES84LHzN8Guj5M82kEK79jUK6HG2ax
sudo apt update
sudo apt -y install wget curl git build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libcurl4-openssl-dev libgtest-dev
cd /usr/src/gtest
sudo cmake .
sudo make
sudo mv libg* /usr/lib/
cd /usr/local/src
@Ernillew
Ernillew / monero.service
Created September 8, 2017 12:58
monero.service
[Unit]
Description=Monero Daemon
After=network.target
[Service]
Type=forking
GuessMainPID=no
ExecStart=/usr/local/src/monero/build/release/bin/monerod --rpc-bind-ip 127.0.0.1 --detach --restricted-rpc
Restart=always
User=monerodaemon
@Ernillew
Ernillew / .bashrc.function.ia-save
Created July 15, 2017 22:03
Bash function for save current site state at web.archive.org
function ia-save() {
curl -s -I "https://web.archive.org/save/$1" |
grep Content-Location |
awk '{printf( "https://web.archive.org/%s\n",$2)}';
}
@Ernillew
Ernillew / ssh-telegram.sh
Created July 14, 2017 21:50 — forked from zamber/ssh-telegram.sh
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# use sed to parse JSON from ipinfo.io
# you can get your user_id by writing to @get_id_bot
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ] && [ -z "$TMUX" ]; then
@Ernillew
Ernillew / innodb_to_rocksdb.sh
Created May 23, 2017 21:50
Converting InnoDB tables to RocksDB(for MariaDB 10.2)
#!/bin/bash
# Converts all InnoDB tables in all databases to ROCKSDB
#DATABASES="db1 db2" # Convert databases db1 and db2 only
DATABASES="ALL" # Convert all databases
MYSQL_USER=user
# Uncomment if you're not using ~/.my.cnf file (will receive "Warning: Using a password on the command line interface can be insecure" warnings)
#MYSQL_PASS='some-secret-password'
@Ernillew
Ernillew / vpnns_down.sh
Last active February 16, 2024 10:08
Shutdown vpn netns
#!/bin/bash
sudo ip netns pids vpn | xargs -rd'\n' sudo kill
sudo rm -rf /etc/netns/vpn
sudo sysctl -q net.ipv4.ip_forward=0
sudo iptables -D INPUT ! -i vpn0 -s 10.10.10.0/24 -j DROP
sudo iptables -t nat -D POSTROUTING -s 10.10.10.0/24 -o en+ -j MASQUERADE
sudo ip link del vpn0
sudo ip netns delete vpn
@Ernillew
Ernillew / vpnns_up.sh
Created September 17, 2016 20:21
Start OpenVPN inside network namespace
#!/bin/bash
sudo ip netns add vpn
sudo ip netns exec vpn ip addr add 127.0.0.1/8 dev lo
sudo ip netns exec vpn ip link set lo up
sudo ip link add vpn0 type veth peer name vpn1
sudo ip link set vpn0 up
sudo ip link set vpn1 netns vpn up
sudo ip addr add 10.10.10.1/24 dev vpn0
sudo ip netns exec vpn ip addr add 10.10.10.2/24 dev vpn1
sudo ip netns exec vpn ip route add 37.59.63.23 via 10.10.10.1 dev vpn1