Skip to content

Instantly share code, notes, and snippets.

View TotalLag's full-sized avatar

Chris Phan TotalLag

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / debian.php
Created May 8, 2019 04:08
Upgrade PHP on Debian
sudo apt install -y apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt update
sudo apt-get install -y php7.3 php7.3-common
sudo apt-get install -y php7.3-curl php7.3-xml php7.3-zip php7.3-gd php7.3-mysql php7.3-mbstring php7.3-sqlite3
sudo apt-get purge -y php7.0 php7.0-common
@TotalLag
TotalLag / fix_npm.sh
Created June 24, 2019 16:38
Fix npm Maximum call stack size exceeded on npm install
When/If you run into the following when trying to install @vue/cli similar:
Maximum call stack size exceeded on npm install
Reinstall NPM:
https://github.com/brock/node-reinstall
Do perms if installed as root
https://stackoverflow.com/questions/51811564/sh-1-node-permission-denied
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
defaultViewport: null,
args:[
'--no-sandbox',
'--ignore-certificate-errors',
'--window-size=1920,1080'
],
@TotalLag
TotalLag / win-runas.py
Created July 15, 2020 02:29
Re-run the program with admin rights in Python
import sys
import ctypes
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if is_admin():
@TotalLag
TotalLag / sandboxie.ini
Created February 15, 2022 03:43
Sandboxie config for Steam
[GlobalSettings]
FileRootPath=\??\%SystemDrive%\Sandbox\%USER%\%SANDBOX%
SeparateUserFolders=y
KeyRootPath=\REGISTRY\USER\Sandbox_%USER%_%SANDBOX%
IpcRootPath=\Sandbox\%USER%\%SANDBOX%\Session_%SESSION%
NetworkEnableWFP=n
EditAdminOnly=y
ForceDisableAdminOnly=n
ForgetPassword=n
Template=WindowsRasMan