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
#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/
@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
@VarunAgw
VarunAgw / Instructions.txt
Last active April 13, 2017 18:06
How to Install GateOne on Ubuntu 14.04.3
wget https://github.com/downloads/liftoff/GateOne/gateone_1.1-1_all.deb
wget https://github.com/downloads/liftoff/GateOne/python-tornado_2.4-1_all.deb
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
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 / 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 / KeyCode.js
Last active November 24, 2018 21:19
TamperMonkey Scripts
if (typeof KeyCode == "undefined") {
/**
* A fancier way to parse JS keydown events
* Author: Varun Agrawal <Varun@VarunAgw.com>
* Source: https://gist.github.com/VarunAgw/58ab41fd3d48ac51808c76617842dccf#file-keycode-js
* 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
VarunAgw / win_run.ahk
Created April 5, 2017 09:41
AHK Scripts
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
VarunAgw / code.ahk
Last active February 5, 2022 04:38
AHK Support for Stardock Groupy
CoordMode, Mouse, Screen
CoordGetWin(xCoord, yCoord, ExludeWinID="") ; CoordMode must be relative to screen
{
WinGet, IDs, List,,, Program Manager
Loop, %ids%
{
_hWin := ids%A_Index%
WinGetTitle, title, ahk_id %_hWin%
WinGetPos,,, w, h, ahk_id %_hWin%
@VarunAgw
VarunAgw / yify.md
Created October 11, 2020 15:42 — forked from kuntau/yify.md
YIFY's Quality Encoding

For those that want to keep the YTS going (No, IDGAF about people that don't care for YTS quality) get HandbrakeCLI https://handbrake.fr/downloads... and use the following settings:

user@user:~$HandBrakeCLI -i /file/input.mp4 -o /file/out.mp4 -E fdk_faac -B 96k -6 stereo -R 44.1 -e x264 -q 27 -x cabac=1:ref=5:analyse=0x133:me=umh:subme=9:chroma-me=1:deadzone-inter=21:deadzone-intra=11:b-adapt=2:rc-lookahead=60:vbv-maxrate=10000:vbv-bufsize=10000:qpmax=69:bframes=5:b-adapt=2:direct=auto:crf-max=51:weightp=2:merange=24:chroma-qp-offset=-1:sync-lookahead=2:psy-rd=1.00,0.15:trellis=2:min-keyint=23:partitions=all

Reason to use CLI over GTK has to do with lack of support for advanced settings for Handbrake GTK

** Don't Re-encode already shitty encodes...get good source!**

@VarunAgw
VarunAgw / apps.md
Last active March 31, 2022 16:53
Amazon Fire TV Stick