sudo apt-get install winbind
WINEPREFIX=/home/<username>/.wine-<myprefix> WINEARCH=win32 wine 'wineboot'
# default nice value seems fine in my case; ionice has no default, using class 3 for idle IO time | |
ionice -c 3 nice tar ~/the-webapp-20150106.tgz /opt/the-webapp |
kill -0 $(ps -eo pid,command | grep nginx | grep master | awk -F ' ' '{print $1}') |
exec su -l $USER |
# trick is to match on a non-printing character (^ is beginning of line) OR your pattern. | |
# this way all lines match but only your pattern containing printable characters will be highlighted | |
# using ^ requires Extended-Regexp option (-E) | |
grep -E '^|pattern' file.log |
echo "syntax for base conversion in bash is: \$((\$BASE#\$VALUE))" | |
echo | |
echo "Decimal value of Hexadecimal 2B: \$((16#2B))" | |
echo $((16#2B)) | |
echo | |
echo "Decimal value of binary 0110: \$((2#0110))" | |
echo $((2#0110)) | |
echo |
echo "\$# is the number of arguments" | |
echo "$# arguments" | |
echo | |
echo "\$* is list of arguments joined into a string" | |
echo $* | |
echo | |
echo "\$@ is a sequence of strings, well suited to a for loop" | |
echo $@ |
#!/usr/bin/env php | |
<?php | |
/* convert Multi Site Manager (MSM) ExpressionEngine (EE) database to single site database. | |
* used to split a site to own EE instance without MSM. | |
* Deletes all sites other than site_id specified then changes specified sites id to 1. | |
* Ignores site_id 0, although I don't rememeber why. | |
* I ran it from Linux command line, no idea if it will run the same on Window or Mac. | |
*/ |
#!/usr/bin/env bash | |
# transfer mysql database to different server with a new name | |
# such as production database to test database | |
read -p "source host:" SRC_HOST | |
read -p "user for host $SRC_HOST:" SRC_USER | |
read -p "password for $SRC_USER@$SRC_HOST:" -s SRC_PW; echo | |
read -p "source database name:" SRC_DB | |
read -p "target host:" TGT_HOST |
# set hostname to lower in /etc/hosts file | |
sed -i "s/$(hostname)/$(hostname | tr '[:upper:]' '[:lower:]')/" /etc/hosts | |
# set runtime hostname to lowercase | |
hostname $(hostname | tr '[:upper:]' '[:lower:]') | |
# save lowercase hostname to /etc/hostname file | |
hostname > /etc/hostname |