Skip to content

Instantly share code, notes, and snippets.

View Hemant-Mann's full-sized avatar
🎯
Focusing

Hemant Mann Hemant-Mann

🎯
Focusing
View GitHub Profile
@Hemant-Mann
Hemant-Mann / code.md
Last active February 20, 2016 10:40
Wget Website Downloader
wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-name=windows --domains {domain-name} --no-parent {http://domain-name/}
@Hemant-Mann
Hemant-Mann / steps
Last active October 1, 2015 13:35
Bitbucket Backup
1. Login in to the server
----- Performed only once --------
2. Ensure SSH is installed
$ ssh -v
3. Setup default identity
a) $ ssh-keygen
(Choose the default location i.e. ~/ssh/id_rsa)
(Dont enter any passphrase)
@Hemant-Mann
Hemant-Mann / git_short
Last active November 7, 2016 05:21
Just enter the message for commit and it will commit to master
#!/bin/bash
if [[ ! -d .git ]]; then
echo "Fatal error: not a git repository"
exit 1
fi
if [[ $# < 1 ]]; then
git status
exit 1
@Hemant-Mann
Hemant-Mann / parse_json.py
Last active April 15, 2016 04:47
Very Simple script to parse json file
import json
import sys
from pprint import pprint
jdata = open(sys.argv[1])
data = json.load(jdata)
print data["db_name"]
print data["mysql"]
@Hemant-Mann
Hemant-Mann / automated_backup_script.sh
Last active June 1, 2016 08:04
Automated Script to take backup of projects
#!/bin/bash
# Initialize Global Variables
db_name=
mysql_root=
server_ip=
server_user=
server_pass=
server_path=
project=
@Hemant-Mann
Hemant-Mann / cloudflare_email_decode.js
Created March 9, 2021 13:11
Cloudflare email decoder
function cfDecodeEmail(encodedString) {
var email = "", r = parseInt(encodedString.substr(0, 2), 16), n, i;
for (n = 2; encodedString.length - n; n += 2){
i = parseInt(encodedString.substr(n, 2), 16) ^ r;
email += String.fromCharCode(i);
}
return email;
}
@Hemant-Mann
Hemant-Mann / kill-zombie-process.sh
Created June 11, 2021 04:16
kill zombie processes
top -b1 -n1 | grep Z
ps -A -ostat,ppid | grep -e '[zZ]'| awk '{ print $2 }' | uniq | xargs ps -p
kill $(ps -A -ostat,ppid | grep -e '[zZ]'| awk '{ print $2 }')
@Hemant-Mann
Hemant-Mann / killall-ssh-agent
Created June 16, 2021 13:23
kill all ssh-agent process
kill $(ps aux | grep 'ssh-agent' | awk '{print $2}')
@Hemant-Mann
Hemant-Mann / allow-copy-paste.js
Created June 24, 2021 10:33
Add copy paste functionality on bank websites 😁
var allowPaste = function(e){
e.stopImmediatePropagation();
return true;
};
document.addEventListener('paste', allowPaste, true);
#!/bin/bash
## reference: https://unix.stackexchange.com/questions/40638/how-to-do-i-convert-an-animated-gif-to-an-mp4-or-mv4-on-the-command-line
ffmpeg -i IMG_a.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video_a.mp4