Skip to content

Instantly share code, notes, and snippets.

# pull the kali docker
docker pull kalilinux/kali-linux-docker
# run the container
docker run --interactive --tty --network=host --privileged --name=kali kalilinux/kali-linux-docker bash
# install top 10 tools https://www.kali.org/news/kali-linux-metapackages/
apt update && apt install kali-linux-top10
@himalay
himalay / openPopupWin.js
Last active August 30, 2017 10:19
Open centered popup window
// open with html string
function openPopupWin (content, width, height) {
var w = innerWidth || document.documentElement.clientWidth || screen.width
var h = innerHeight || document.documentElement.clientHeight || screen.height
var position = 'scrollbars=yes,width=' + width + ',height=' + height
position += ',top=' + ((h - height) / 2 + screenTop || screen.top || 0)
position += ',left=' + ((w - width) / 2 + screenLeft || screen.left || 0)
var popupWin = window.open('about:blank', '', position)
popupWin.document.write(content)
@himalay
himalay / console.log.js
Last active November 12, 2023 09:50
Colorful console.log in js
// browser
console.log('%c Fucking hell! ', 'background: #222; font-size: 42px; color: #ff0000');
// nodejs
console.log('\x1b[36m%s\x1b[0m', info); //cyan
console.log('\x1b[33m%s\x1b[0m: ', path); //yellow
//Here is reference of colors and other characters:
Reset = "\x1b[0m"
Bright = "\x1b[1m"
@himalay
himalay / .bash_profile
Last active August 9, 2017 04:43
Git bash profile
######## PROMPT ########
# export PS1="\[\e]0;\W\a\]\n\[\e[32m\]➜\[\e[m\] \[\033[1;36m\]\W\[\033[0m\] $(__git_ps1) "
# $ \[\033]0;$TITLEPREFIX:${PWD//[^[:ascii:]]/?}\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__g it_ps1`\[\033[0m\]\n$
if test -f /etc/profile.d/git-sdk.sh
then
TITLEPREFIX=SDK-${MSYSTEM#MINGW}
else
TITLEPREFIX=$MSYSTEM
fi
@himalay
himalay / curspr2end.js
Created August 3, 2017 14:59
Move Cursor To End
function moveCursorToEnd(el) {
if (typeof el.selectionStart == "number") {
el.selectionStart = el.selectionEnd = el.value.length;
} else if (typeof el.createTextRange != "undefined") {
el.focus();
var range = el.createTextRange();
range.collapse(false);
range.select();
}
}
switch (operation) {
case "fromPercentage": // what is 5% of 20 ? 1
var totalValue = a / 100 * b;
break;
case "toPercenrage": // 25 is what percent of 50 ? 50%
var totalValue = a / b * 100;
break;
case "diffPercentage": // from 20 to 50 ? 150%
var totalValue = (b - a) / a * 100;
break;
@himalay
himalay / git.sh
Last active October 23, 2022 22:58
[git]
### get all branch
git branch -a | grep -v HEAD | perl -ne 'chomp($_); s|^\*?\s*||; if (m|(.+)/(.+)| && not $d{$2}) {print qq(git branch --track $2 $1/$2\n)} else {$d{$_}=1}' | csh -xfs
#### GET URL FROM LOCAL REPO
git config --get remote.origin.url
#### change git remote url
git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.git
git clone -b betav1 [email protected]:krishontreat/pain_diary.git
@himalay
himalay / flip.css
Last active January 30, 2020 07:09
Flip element css
.flip {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
}
@himalay
himalay / alive.sh
Last active August 3, 2017 14:48
keep something alive in linux box
#!/bin/bash
ps -ef | egrep "node.+app.js" > /dev/null
if [[ $? -ne 0 ]]; then
pm2 start 2 // node process manager
echo "`date` : app started." >> ~/app.log
fi
# cron
*/5 * * * * /home/user/bin/node_app.sh
#----------------------
@himalay
himalay / lowercase.js
Created August 3, 2017 14:45
Lowercase field
//<input type="text" id="txt" onkeyup="return forceLower(this);"/>
function forceLower(strInput)
{
strInput.value=strInput.value.toLowerCase();
}