open ~/.bashrc in text editor and uncomment line:
#force_color_prompt=yes
to be:
force_color_prompt=yes
open ~/.bashrc in text editor and uncomment line:
#force_color_prompt=yes
to be:
force_color_prompt=yes
# Exception Handling | |
def spam(divideBy): | |
return 42 / divideBy | |
try: | |
print(spam(2)) | |
print(spam(12)) | |
print(spam(0)) | |
print(spam(1)) | |
except ZeroDivisionError: |
#download | |
youtube-dl -F <URL> # see all format | |
youtube-dl -f <format> <URL> # download format | |
# DASH decode | |
ffmpeg -i input.m4a -vn -acodec copy output.m4a # Solve: writing DASH m4a. Only some players support this container. Install ffmpeg or avconv to fix this automatically. | |
#mp3 | |
ffmpeg -codecs help | grep 'mp3' # check mp3 codecs | |
ffmpeg -i input.m4a -acodec libmp3lame -ab 128k output.mp3 |
sudo service beanstalkd stop | |
sudo service supervisor stop | |
sudo service memcached stop | |
sudo service hhvm stop |
<?php | |
// ref: http://stackoverflow.com/questions/356128/can-i-extend-a-class-using-more-than-1-class-in-php | |
class B { | |
public function method_from_b($s) { | |
echo $s; | |
} | |
} | |
class C { | |
public function method_from_c($s) { |
[mysqld] | |
skip-log-bin | |
innodb_file_per_table=1 | |
expire_logs_days = 1 | |
max_binlog_size = 10M | |
#use following detail to clean everything about bin log | |
#PURGE BINARY LOGS TO 'mysql-bin.000029'; | |
#RESET MASTER; |
select count(id), join_datetime from customers | |
where status > 0 | |
group by DATE(join_datetime) | |
order by join_datetime desc | |
select count(id), join_datetime from customers | |
where status > 0 | |
group by MONTH(join_datetime) | |
order by join_datetime desc |
<IfModule mod_ssl.c> | |
<VirtualHost *:443> | |
ServerAdmin webmaster@localhost | |
ServerName domain.com.au | |
DocumentRoot /path-to-www | |
SuexecUserGroup web-data web-data | |
#LogLevel info ssl:warn | |
ErrorLog ${APACHE_LOG_DIR}/error-ssl-html.log | |
CustomLog ${APACHE_LOG_DIR}/access-ssl-html.log combined |
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'dbpassword' WITH GRANT OPTION; | |
FLUSH PRIVILEGES; |
#!/bin/bash | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
CURRENT_USER=$(id -u -n) | |
CURRENT_GROUP=$(id -g -n) | |
CURRENT_USER_HOME=$(eval echo ~${SUDO_USER}) |