Skip to content

Instantly share code, notes, and snippets.

View TotalLag's full-sized avatar

Chris Phan TotalLag

View GitHub Profile
@TotalLag
TotalLag / gateway.service
Created June 6, 2015 16:22
Network setup for CoreOS on MyCustomHosting
[Unit]
Description=Add MCH Gateway
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/route add <gateway> dev eth0
ExecStart=/usr/bin/route add default gw <gateway>
[Install]
@TotalLag
TotalLag / install-docker.sh
Last active September 16, 2015 18:33
Installs the latest version of Docker
#!/bin/bash
sudo su
echo deb https://apt.dockerproject.org/repo ubuntu-`cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d'=' -f2` main >> /etc/apt/sources.list.d/docker.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F76221572C52609D
apt-get update
apt-get purge --auto-remove lxc-docker* -y &&
apt-get purge --auto-remove docker.io* -y &&
apt-get install docker-engine -y
@TotalLag
TotalLag / Ubuntu Kernel Upgrader Script
Last active October 26, 2015 17:54 — forked from mmstick/Ubuntu Kernel Upgrader Script
Downloads the generic kernel and installs it.
#!/bin/bash
cd /tmp
if ! which lynx > /dev/null; then sudo apt-get install lynx -y; fi
if [ "$(getconf LONG_BIT)" == "64" ]; then arch=amd64; else arch=i386; fi
function download() {
wget $(lynx -dump -listonly -dont-wrap-pre $kernelURL | grep "$1" | grep "$2" | grep "$arch" | cut -d ' ' -f 4)
}
#!/bin/bash
sudo su
ulimit -n 99999
echo '* hard nofile 500000' >> /etc/security/limits.conf
echo '* soft nofile 500000' >> /etc/security/limits.conf
echo 'root hard nofile 500000' >> /etc/security/limits.conf
echo 'root soft nofile 500000' >> /etc/security/limits.conf
@TotalLag
TotalLag / swap.sh
Last active November 28, 2019 20:18 — forked from superbarne/gist:77bd850d5c270bf7cad4
Enable Swap
fallocate -l 4G /swapfile || sudo dd if=/dev/zero of=/swapfile count=4096 bs=1MiB && \
chmod 600 /swapfile && \
mkswap /swapfile && \
swapon /swapfile && \
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
@TotalLag
TotalLag / crawl.sh
Last active September 3, 2021 11:30
modified to warm up cloudflare cache
#!/bin/bash
# warmly.sh
# A wget based, easy, poor man`s cache warmer script
# https://gist.github.com/thomasfr/7926314
# The MIT License (MIT)
#
# Copyright (c) 2013,2014 Thomas Fritz <fritztho@gmail.com> (http://fritzthomas.com)
#
@TotalLag
TotalLag / EdgeMax traffic-policy shaper
Last active June 20, 2020 12:14
Prioritize via DPI and allow 100% bandwidth usage if network is idle
set firewall modify QoS description 'mark packets for QoS'
set firewall modify QoS rule 20 action modify
set firewall modify QoS rule 20 application category Voice-over-IP
set firewall modify QoS rule 20 description VoIP
set firewall modify QoS rule 20 modify mark 20
set firewall modify QoS rule 40 action modify
set firewall modify QoS rule 40 application category Games
set firewall modify QoS rule 40 description Games
set firewall modify QoS rule 40 modify mark 40
@TotalLag
TotalLag / EdgeMax advanced-queue QoS
Last active August 5, 2020 03:57
An upgrade from traffic-policy shaper
set traffic-control advanced-queue root queue 1 bandwidth 50mbit
set traffic-control advanced-queue root queue 1 attach-to global
set traffic-control advanced-queue queue-type sfq SFQ_DOWN
set traffic-control advanced-queue queue-type fq-codel FQCODEL_UP ecn disable
set traffic-control advanced-queue queue-type fq-codel FQCODEL_DOWN target 5ms
set traffic-control advanced-queue queue-type fq-codel FQCODEL_DOWN quantum 1514
set traffic-control advanced-queue queue-type fq-codel FQCODEL_DOWN limit 1001
set traffic-control advanced-queue queue-type fq-codel FQCODEL_DOWN interval 50ms
set traffic-control advanced-queue queue-type fq-codel FQCODEL_DOWN flows 1024
set traffic-control advanced-queue queue-type fq-codel FQCODEL_DOWN ecn enable
@TotalLag
TotalLag / config.boot
Last active August 8, 2022 19:56
My config commands on a UBNT EdgeRouter 5 PoE
firewall {
all-ping enable
broadcast-ping disable
group {
address-group Chromecast {
address 239.255.255.250
description "Use /32"
}
address-group Private-RFC-Ranges {
address 10.0.0.0/8
@TotalLag
TotalLag / Unattended upgrades
Created June 10, 2017 18:19
Keep your server current with the latest security (and other) updates automatically. To setup automatic updates, run these commands as root:
apt-get install unattended-upgrades apt-listchanges
dpkg-reconfigure -plow unattended-upgrades