Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
if [ -z "$1" ]
then
echo "Input ssh creditals"
exit;
fi
#check key exists
if [ ! -f ~/.ssh/id_rsa ]; then
@shivergard
shivergard / gen.js
Created March 4, 2015 14:30
LV Personal Code generator
window.genPk = function (argument) {
if (typeof argument == 'undefined'){
argument = {};
}
if (typeof argument.date == 'undefined'){
startTime =new Date.today().add(-18).years();
endTime =new Date.today().add(-70).years();
@shivergard
shivergard / rand.js
Created February 23, 2015 15:54
random
function makeid()
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < Math.random() * possible.length; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
#!/bin/bash
NOW=$(date +"%m-%d-%Y")
FILE="hosts.$NOW.txt"
cp /etc/hosts /opt/bckups/$FILE
if [ -z "$1" ];
then
echo "" > /opt/bckups/tmpList
sed '/facebook.com/d;/vk.com/d' /etc/hosts >> /opt/bckups/tmpList
# replaces a string with another string
# @param string source string
# @param string search string
# @param string replacement string"
# usage: result="$(str_replace "foo bar" "foo" "hi")"
function str_replace()
{
[ -z "$1" ] && return 1
[ -z "$2" ] && return 1
"settings":
{
"build_on_save": 1 ,
"from_to_onsave" :
{
"first" : {
"from" : "from" ,
"to" : "[email protected]:/to"
}
}
@shivergard
shivergard / gist:9471353
Created March 10, 2014 18:36
Chrome context menu
chrome.contextMenus.create({
"title": "Extract Profile",
"contexts": ["page", "selection", "image", "link"],
"onclick" : function (info, tab) {
console.log(info);
console.log(tab);
}
});
var clickHandler = function(e) {
@shivergard
shivergard / web.sh
Created February 22, 2014 07:48
Init portable WebRoot in BackTrack5 Live CD
#!/bin/sh
service apache2 start
service mysql start
rm -fR /var/www
ln -s $(pwd)/www/ /var/www
@shivergard
shivergard / sub.sh
Created February 22, 2014 07:47
Init portable Sublime_Text2 in BackTrack5 Live CD
#!/bin/sh
ln -s $(pwd)/config/sublime-text-2 /root/.config/sublime-text-2
ln -s $(pwd)/bin/sublime /opt/sublime
/opt/sublime/sublime_text
rm /root/.config/sublime-text-2
rm /opt/sublime
@shivergard
shivergard / hg.sh
Created February 22, 2014 07:44
Mercurial and Tortoise in BackTrack5 Live CD
apt-get mercurial
#last BT it is MustHave
apt-get install python-software-properties
#
add-apt-repository ppa:tortoisehg-ppa/releases
apt-get install tortoisehg