Skip to content

Instantly share code, notes, and snippets.

@dcai
dcai / valid.php
Last active December 15, 2015 09:49
This is valid php, it passed `php -l` check O_o
<?php
https://gist.github.php
?>
@dcai
dcai / git_update_moodle.sh
Last active October 26, 2017 03:39
git_update_moodle.sh
#!/bin/bash
# Your github username
github_user="dcai"
# The remote name of your github repo, it usually origin
github_remote_name="github"
### STOP CONFIG SINCE HERE! ###
github_diff_root="https://github.com/$github_user/moodle/compare/"
@dcai
dcai / launch.sh
Last active December 22, 2015 03:09
mysql-proxy
echo `pwd`/proxy.lua
mysql-proxy --proxy-lua-script=`pwd`/proxy.lua --log-level=debug
@dcai
dcai / cron-git-update-equella.sh
Last active October 26, 2017 03:39
cron-git-update-equella.sh
#!/bin/bash
GITLOG="/var/log/equella/cron-update.log"
LOGFILE="/tmp/equellacodeupdate.log"
HTMLFILE="/tmp/equellacodeupdate.html"
EMAILADDR="[email protected]"
FROMEMAILADDR="[email protected]"
SUBJECT="EQUELLA code"
EQSRC=/var/equella-source/
@dcai
dcai / php_error_log.sh
Last active December 23, 2015 16:59
Verify php error log
php -n -d error_log=./error.log -d log_errors=1 -r '<?php error;'
@dcai
dcai / customwiki2html.sh
Created September 28, 2013 10:36
alternative customwiki2html.sh for vimwiki, it supports template and interlink.
#!/bin/bash
MARKDOWN=markdown
MKD2HTML=mkd2html
FORCE="$1"
SYNTAX="$2"
EXTENSION="$3"
OUTPUTDIR="$4"
@dcai
dcai / cliclock.sh
Created December 18, 2013 05:58 — forked from Goles/cliclock.sh
World clock
#!/bin/sh
# Command-line world clock
# Taken from http://stackoverflow.com/questions/370075/command-line-world-clock
# .worldclock.zones file looks like:
# US/Pacific
# Europe/Berlin
# Chile/Continental
: ${WORLDCLOCK_ZONES:=$HOME/.worldclock.zones}
@dcai
dcai / ato.md
Last active October 26, 2017 03:41 — forked from warnergodfrey/gist:7512051
Setup ATO AusKey for mac
  • Install the latest JRE from Oracle
  • In the Java Control Panel, go to the Security tab and make sure 'Enable Java Content' is checked
  • Open Safari
  • Go to the ATO Business portal site https://bp.ato.gov.au/BpStatics/homepage.htm
  • Click Login
  • A dialog will apear asking you 'Do you want to trust the website “authentication.business.gov.au” to use the “Java” plug-in?'
  • Click 'Trust'
  • Now you will be asked 'Do you want to run this application?'
  • Click 'Run'
  • Another dialog will appear asking you to 'Allow access to the following application from this website?'
@dcai
dcai / id_rsa.pub
Last active August 29, 2015 14:06
id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxH+9GYhS8qlhTcdlJuWkS38IKHbVuxsbcFHKSOaI9IbauvEkTfcR9DaAZrhFLDeDifSi9cy6IpzjZL30n1MkV9tN6i2TJ/OvhZPaJtNpKTFNyTLo/jY/NxRle/24LjSm4BnMmb1iijDpL91mi/EjkeccwO8LnWm/wMoRTJKimQSWTknhGmewDMRLXsmaCHOofQRLyOow0+xBGVjlDrO3Qp3r/CgD27ZgkkR/o/b52kxp8/N7EBCknV8Ytrw72IPlVZtlsjOBdkL5taXmhdBhOARBl1fWzUmm89ikITlwctpohDocnj/Qe/hYmh6p/gbgl/av5TwBfbx5KTsbKnTmNQ==
@dcai
dcai / upgrade_pg93.sh
Last active October 26, 2017 03:41 — forked from ibussieres/upgrade_pg.sh
upgrade_pg93.sh
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
sudo su - postgres -c "service postgresql stop"
sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"'