Skip to content

Instantly share code, notes, and snippets.

View TotalLag's full-sized avatar

Chris Phan TotalLag

View GitHub Profile
@TotalLag
TotalLag / Redirect-UsersFolders.ps1
Last active November 25, 2018 19:14 — forked from aaronparker/Redirect-FoldersOneDrive.ps1
Redirects select folders to another drive (or the OneDrive folder).
<#
.SYNOPSIS
Sets a known folder's path using SHSetKnownFolderPath.
.PARAMETER KnownFolder
The known folder whose path to set.
.PARAMETER Path
The target path to redirect the folder to.
.NOTES
Forked from: https://gist.github.com/semenko/49a28675e4aae5c8be49b83960877ac5
#>
@TotalLag
TotalLag / update_fw.sh
Created October 15, 2017 23:31
Update UFW to allow DNS requests from host
#!/bin/bash
HOSTNAME=$1
LOGFILE=$HOSTNAME.log
Current_IP=$(host $HOSTNAME | head -n1 | cut -f4 -d ' ')
if [ ! -f $LOGFILE ]; then
/usr/sbin/ufw allow from $Current_IP to any app DNS
echo $Current_IP > $LOGFILE
else
@TotalLag
TotalLag / jumpbox.sh
Created August 24, 2017 12:53
persistent tunnel
#!/bin/bash
createTunnel() {
/usr/bin/ssh -N -R 2222:localhost:22 serverUser@25.25.25.25
if [[ $? -eq 0 ]]; then
echo Tunnel to jumpbox created successfully
else
echo An error occurred creating a tunnel to jumpbox. RC was $?
fi
}
/bin/pidof ssh
@TotalLag
TotalLag / Contract Killer 3.md
Last active February 1, 2020 14:08 — forked from tony-caffe/Contract Killer 3.md
The latest version of Bytes Unlimted ‘killer contract’ for web professionals

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Revised by Totallag : Aug 10th 2017

@TotalLag
TotalLag / gist:843a38ad2a76ee173b3d7c55ddc7d4cb
Last active August 5, 2017 21:49
Webpack/Phenomic hot-reload
Set the environment variable `CHOKIDAR_USEPOLLING=1` and Chokidar will switch to polling mode.
i.e.
"scripts": {
"lint:js": "eslint --ignore-path .gitignore --fix .",
"lint:css": "stylelint \"src/**/*.css\"",
"lint": "npm-run-all --parallel lint:*",
"start": "CHOKIDAR_USEPOLLING=1 phenomic start",
"build": "phenomic build",
"pretest": "npm run lint",
"test": "npm run build"
@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
@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 / 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 / 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 / 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)
#