Skip to content

Instantly share code, notes, and snippets.

Global Citizen

Varun Agrawal VarunAgw

Global Citizen
Block or report user

Report or block VarunAgw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View win_run.ahk
SetLineEnding(text, line_ending:="`n") {
text := StrReplace(text, "`r`n", "`n")
text := StrReplace(text, "`r", "`n")
if ("`n" != line_ending) {
text := StrReplace(text, "`n", line_ending)
return %text%
StrCount( ByRef Haystack , Needle = "" ) {
VarunAgw / KeyCode.js
Last active Nov 24, 2018
TamperMonkey Scripts
View KeyCode.js
if (typeof KeyCode == "undefined") {
* A fancier way to parse JS keydown events
* Author: Varun Agrawal <>
* Source:
* Version: 1.3
* Last Updated: 23-July-2016
* @param {object} event: Just forward the event
* @param {array|number} possibleKeyCodes: Use single keycode or an array of codes to match either of them
VarunAgw / iptables
Last active Feb 22, 2016
iptables cheatsheet
View iptables
-s = Source IP
-d = Destination IP
-sport = Source Port
VarunAgw /
Last active Feb 15, 2016
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/*
VarunAgw / Instructions.txt
Last active Apr 13, 2017
How to Install GateOne on Ubuntu 14.04.3
View Instructions.txt
Note: Don't use "Python-tornado 3.x" with it. It causes some error.
apt-get install python-support
dpkg -i python-tornado_2.4-1_all.deb
dpkg -i gateone_1.1-1_all.deb
service gateone start
VarunAgw / Main
Created Jun 4, 2015
Process in background
View Main
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
View .htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php
#Redirect an entire site:
Redirect 301 /
#Redirect an entire site to a sub folder
Redirect 301 /
You can’t perform that action at this time.