Skip to content

Instantly share code, notes, and snippets.

View VarunAgw's full-sized avatar
🌎
Global Citizen

Varun Agrawal VarunAgw

🌎
Global Citizen
View GitHub Profile
@VarunAgw
VarunAgw / iptables
Last active February 22, 2016 13:42
iptables cheatsheet
Programs:
iptables
ip6iptables
Type:
INPUT OUTPUT FORWARD
ACCEPT DROP REJECT
-s = Source IP
-d = Destination IP
-sport = Source Port
@VarunAgw
VarunAgw / tldr.sh
Last active February 15, 2016 16:07
A simple script to cache TLDR Node.JS client output to improve performance
Generally each command takes ~500ms, but with this, they will take ~10ms to execute. Add this into shell profile page
function tldr () {
mkdir -p /tmp/tldr_cache
if [ "--flush-cache" == $1 ]; then
rm /tmp/tldr_cache/*
return
fi
@VarunAgw
VarunAgw / Main
Created June 4, 2015 10:56
Process in background
Move running process in background
A) Ctrl + Z (It suspends (like pause) process)
B) bg (Its keeps running in background)
Move new process in background
A) sleep 10 & (Print output to terminal whenever it comes)
A) nohup sleep 10 & (Saves output to a file nohup.out)
A) sleep 10> /dev/null & (output is lost)
Move background process to foreground
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/