This file contains 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 utf8ize($d) { | |
if (is_array($d)) { | |
foreach ($d as $k => $v) { | |
$d[$k] = utf8ize($v); | |
} | |
} else if (is_string ($d)) { | |
// return utf8_encode($d); | |
return iconv(mb_detect_encoding($d), "UTF-8", $d); |
This file contains 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 numberToCurrency($number) | |
{ | |
if(setlocale(LC_MONETARY, 'en_IN')) | |
return money_format('%.0n', $number); | |
else { | |
$explrestunits = "" ; | |
$number = explode('.', $number); | |
$num = $number[0]; |
This file contains 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
<script src="https://code.jquery.com/jquery-1.10.2.js"></script> | |
<script type="text/javascript"> | |
goodRead('9382749004'); // not found | |
goodRead('0441172717'); // single author | |
goodRead('0552137030'); // multiple author | |
function goodRead(isbn) { | |
var key = "<your key>"; // replace with your key |
This file contains 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
// Source: http://askubuntu.com/questions/162866/correct-permissions-for-var-www-and-wordpress | |
// First, you should ensure that your username is included in www-data group. If not, you can add your username as www-data group | |
sudo adduser $USER www-data | |
// After that, you should change the ownership of /var/www to your username | |
sudo chown $USER:www-data -R /var/www | |
// Next step, you should change permission to 755 (rwxr-xr-x), not recommend changing permission to 777 for security reason | |
sudo chmod u=rwX,g=srX,o=rX -R /var/www |
This file contains 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
#to open localhost in browser | |
# this section not working for now | |
#if [ -n $BROWSER ]; then | |
# $BROWSER 'http://wwww.google.com/' | |
# | |
#elif | |
if which xdg-open > /dev/null; then | |
xdg-open 'http://localhost/' |
This file contains 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
echo 'installing LAMP Stack' && | |
echo '=====================' && | |
sudo apt-get update && | |
echo 'installing Apache server' && | |
sudo apt-get install -y apache2 && | |
echo 'installing MySQL' && | |
#will ask the password of root user two times (password=123456 i chose) | |
sudo apt-get -y install -y mysql-server php5-mysql && |
This file contains 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
echo "Downloading GetDeb and PlayDeb" && | |
wget http://archive.getdeb.net/install_deb/getdeb-repository_0.1-1~getdeb1_all.deb http://archive.getdeb.net/install_deb/playdeb_0.3-1~getdeb1_all.deb && | |
echo "Installing GetDeb" && | |
sudo dpkg -i getdeb-repository_0.1-1~getdeb1_all.deb && | |
echo "Installing PlayDeb" && | |
sudo dpkg -i playdeb_0.3-1~getdeb1_all.deb && | |
echo "Deleting Downloads" && |
This file contains 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
#!/bin/bash | |
t=$(mktemp) | |
locate "$1" | awk '{ printf "%4d\t\"%s\"\n", NR, $0 }' > $t | |
[[ -s $t ]] || { echo "No results found"; exit; } | |
rows=$(wc -l "$t" | cut -d' ' -f1) | |
if [[ $rows == 1 ]]; then |
This file contains 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
alias cls='clear' | |
alias ipconfig='ifconfig' | |
alias install='sudo apt install -y' | |
alias uninstall='sudo apt purge -y' | |
alias update='sudo apt update' | |
alias upgrade='sudo apt upgrade' | |
alias majorupgrade='sudo apt-get dist-upgrade' | |
alias clean='sudo apt -f -y install && sudo apt autoremove -y && sudo apt -y autoclean && sudo apt -y clean' | |
alias dir='ls' | |
alias del='rm' |
NewerOlder