Skip to content

Instantly share code, notes, and snippets.

View cyrex562's full-sized avatar

Josh Madden cyrex562

  • Occams Razor Technologies, LLC
  • Reston, VA
View GitHub Profile
@cyrex562
cyrex562 / softether.sh
Created November 24, 2019 17:12 — forked from bouroo/softether.sh
Install softether vpn server on ubuntu 16.04+
#!/usr/local/env bash
# Register vultr.com with free credit https://www.vultr.com/?ref=8221367-4F
# Create vps with 5usd price
# Tested on Ubuntu 18.04, Debian 9.6
# How to...
# 1. Save this file as softether-installer.sh
# 2. chmod +x softether-installer.sh
# 3. Run bash file
# > ./softether-installer.sh
# Or just
@cyrex562
cyrex562 / root_storage_query.promql
Created October 24, 2019 16:17
root partition storage query
((node_filesystem_size_bytes{mountpoint="/"} - node_filesystem_free_bytes{mountpoint="/"}) / node_filesystem_size_bytes{mountpoint="/"} ) * 100
@cyrex562
cyrex562 / mem_query.promql
Created October 24, 2019 16:14
memory prometheus query
((node_memory_MemTotal_bytes - node_memory_MemFree_bytes - node_memory_Cached_bytes - node_memory_Buffers_bytes ) / node_memory_MemTotal_bytes) * 100
@cyrex562
cyrex562 / cpu_query.promql
Created October 24, 2019 16:12
prometheus CPU query
100 - (avg by (job) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)
@cyrex562
cyrex562 / redis.conf
Created September 13, 2019 15:52
redis cluster example config
protected-mode no
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised systemd
pidfile /var/run/redis/redis-server.pid
loglevel notice
logfile /var/log/redis/redis-server.log
@cyrex562
cyrex562 / bootstrap.sh
Created September 4, 2019 19:18
Vagrantfile bootstrap
# configure nanorc
# uncomment set constantshow
sed -i.bak -e '/^#.*constantshow /s/^#//'
# comment nowrap
sed -i.bak -e '/^.*set nowrap/s//#&/'
# un-comment set softwrap
sed -i.bak -e '/^#.*softwrap /s/^#//'
@cyrex562
cyrex562 / setup_wireguard.md
Created May 16, 2019 16:12
Setup Wireguard on a Linux Host

Ubuntu Server 18.04

  1. Add the WireGuard apt repo:

    sudo add-apt-repository ppa:wireguard/wireguard
    sudo apt-get update
  2. Install WireGuard: sudo apt install wireguard

@cyrex562
cyrex562 / configure_source_routing.md
Created May 16, 2019 16:09
Configure source routing

Ubuntu 18.04

  1. Create a routing table entry: echo 200 >> /etc/iproute2/rt_tables
  2. Add a source routing rule: ip rule add from 10.100.100.0/24 lookup src_rt
  3. Add a default gateway to the routing table: ip route add default dev wg0 table src_rt
  4. Add a local network route to the routing table: ip route add 10.100.100.0/24 dev ens34 table src_rt
@cyrex562
cyrex562 / setup_fail2ban.md
Created May 16, 2019 16:08
setup fail2ban on linux hosts

Setup Fail2Ban

Ubuntu 18.04

  1. Install Fail2Ban: sudo apt install -y fail2ban```

  2. Create /etc/fail2ban/jail.d/sshd.conf:

    [sshd]
    enabled = true
@cyrex562
cyrex562 / setup_bird.md
Created May 16, 2019 16:07
install and configure bird on ubuntu 18.04

Ubuntu 18.04

  • Install bird: sudo apt install bird
  • Modify bird config file: nano /etc/bird/bird.conf
  • Enable bird service: systemctl enable bird
  • Apply configuration changes: birdc configure