Skip to content

Instantly share code, notes, and snippets.

View dcai's full-sized avatar
🥃
need a drink

dcai

🥃
need a drink
View GitHub Profile
@dcai
dcai / vm-resize-hard-disk.md
Last active March 8, 2020 12:12 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Steps to resize the hard disk

  1. Stop the virtual machine using Vagrant.

     # cd vg
     # vagrant halt
    
  2. Locate the VirtuaBox VM and the HDD attached to its SATA Controller.

@dcai
dcai / iterm2.md
Created November 28, 2016 03:20
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
Go to Split Pane by Order of Use + ] , + [
@dcai
dcai / postgres_pgpool_arch.md
Last active August 11, 2016 00:00 — forked from afair/gist:3803895
PostgreSQL and Pgpool Architecture

Hey! I saw this has been indexed by the search engines. It is a first draft of a post I ended up publishing on my blog at: Scaling PostgreSQL With Pgpool and PgBouncer

Thanks for stopping by!

PostgreSQL and Pgpool Architecture

@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"'
@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 / 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 / 2010-10-02-14-00-test-migration.py
Created June 26, 2012 14:08 — forked from galvez/2010-10-02-14-00-test-migration.py
A minimalist Python migration management script based on Fabric and sqlwitch
# 2010-10-02 14h00
# Update created field in user_prefs table
def migrate(db):
with db.select('user_id, created', from_='users'):
all_users = db.fetchall()
for user in all_users:
with db.update('user_prefs') as obj:
obj.created = user['created']
db.where('user_id = %s', user['user_id'])
@dcai
dcai / gitolite.sh
Created July 4, 2011 08:56 — forked from masnick/gitolite_hn.bash
Setting up gitolite for archlinux
# First, get you id_rsa.pub onto the server as /tmp/YourName.pub
scp ~/ssh/id_rsa.pub you@git.you.com:/tmp/dongsheng.pub
# Then, as root:
cd $HOME
yaourt -S gitolite-git
su git