This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function url_slug($str, $options = array()) { | |
// Make sure string is in UTF-8 and strip invalid UTF-8 characters | |
$str = mb_convert_encoding((string)$str, 'UTF-8', mb_list_encodings()); | |
$defaults = array( | |
'delimiter' => '-', | |
'limit' => null, | |
'lowercase' => false, | |
'replacements' => array(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use this form to generate your encrypted htaccess password. | |
<form method="post" action=""> | |
<p><input type="text" name="login" placeholder="Login" /></p> | |
<p><input type="text" name="password" placeholder="Password" /></p> | |
<p><input type="submit" value="Get" /></p> | |
</form> | |
<?PHP | |
// demo: http://tmp.itunix.eu/aLog.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).scroll(function () { | |
$('#object').css({ | |
'bottom' : -($(this).scrollTop()/10)+"px" // increase # to make even slower | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .---------------- minute (0 - 59) | |
# | .------------- hour (0 - 23) | |
# | | .---------- day of month (1 - 31) | |
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ... | |
# | | | | .----- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,we$ | |
# | | | | | | |
# * * * * * command to be executed | |
# m h dom mon dow command | |
10 4 * * * vnstati -vs -i venet0 -o /var/vnstati/`date +"%F"`.png | |
10 4 * * * ln -s /var/vnstati/`date +"%F"`.png /var/vnstati/latest.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ssh -4 -N -D 1025 [email protected] | |
1025 is a proxy port (localhost:1025) | |
it work with socks v5! | |
// http://www.sebastian.korotkiewicz.eu/2013/03/30/ssh-tunel-to-your-proxy-webbrowser/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copy the file "foobar.txt" from a remote host to the local host | |
$ scp [email protected]:foobar.txt /some/local/directory | |
Copy the file "foobar.txt" from the local host to a remote host | |
$ scp foobar.txt [email protected]:/some/remote/directory | |
Copy the directory "foo" from the local host to a remote host's directory "bar" | |
$ scp -r foo [email protected]:/some/remote/directory/bar | |
Copy the file "foobar.txt" from remote host "rh1.edu" to remote host "rh2.edu" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#create access for specific IP: | |
iptables -A INPUT -m state --state NEW,ESTABLISHED,RELATED --source x.x.x.x -p tcp --dport 22 -j ACCEPT | |
#block all others | |
iptables -A INPUT -m state --state NEW,ESTABLISHED,RELATED -p tcp --dport 22 -j DROP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
/* | |
* Ask.fm ask question bot, ver 0.1 | |
* Bot can automatically login to your account and ask questions | |
* required: Questions e.g. from mysql and nicks to ask | |
* */ | |
define('SETUSERAGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery Ctrl + S for save | |
$(document).keydown(function(e) { | |
if(e.ctrlKey && e.altKey && e.which === 83) { | |
save(); | |
return false; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
/* | |
how to use? very simple! | |
$ crontab -e | |
add line | |
* 7 * * * php /home/mod/notification.php>/dev/null 2>&1 | |
and save | |
now script will be run from cron every day at 7:00 am and notify you of a new kernel! | |
my blog: http://www.sebastian.korotkiewicz.eu/2013/02/02/notification-of-the-new-linux-kernel-on-your-android-in-php/ |