Generate git change log

Posted: October 31st, 2011 | Author: | Filed under: Development | No Comments »
git whatchanged --since "2 month ago" | grep ^: | awk '{print $6}' | sort | uniq -c | awk '{print $2}' > change.log

Mount samba share on Mac Lion

Posted: October 18th, 2011 | Author: | Filed under: System | 1 Comment »
mount.cifs //griffith/vincent/Projects /mnt/projects -o user=vincent,password=1234,nounix,noserverino,sec=ntlmssp,uid=33,gid=1001,file_mode=0664,dir_mode=0775

Note: only need sec=ntlmssp for Mac


phpMyAdmin config.inc.php

Posted: October 15th, 2011 | Author: | Filed under: Linux | No Comments »
<?php

// Load secret generated on postinst
include('/var/lib/phpmyadmin/blowfish_secret.inc.php');

// Load autoconf local config
include('/var/lib/phpmyadmin/config.inc.php');

$i = 0;
$i++;

if (is_readable('/etc/phpmyadmin/config-db.php')) {
    require('/etc/phpmyadmin/config-db.php');
} else {
    error_log('phpmyadmin: Failed to load /etc/phpmyadmin/config-db.php.'
        . ' Check group www-data has read access.');
}

if (!empty($dbname)) {
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
    if (empty($dbserver)) $dbserver = 'localhost';
    $cfg['Servers'][$i]['host'] = $dbserver;

    if (!empty($dbport) || $dbserver != 'localhost') {
        $cfg['Servers'][$i]['connect_type'] = 'tcp';
        $cfg['Servers'][$i]['port'] = $dbport;
    }
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['controluser'] = $dbuser;
    $cfg['Servers'][$i]['controlpass'] = $dbpass;
    $cfg['Servers'][$i]['pmadb'] = $dbname;
    $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
    $cfg['Servers'][$i]['relation'] = 'pma_relation';
    $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
    $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
    $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
    $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
    $cfg['Servers'][$i]['history'] = 'pma_history';
    $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
    $cfg['Servers'][$i]['tracking'] = 'pma_tracking';
    $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
    $cfg['Servers'][$i]['hide_db'] = '^information_schema|mysql|phpmyadmin$';
    $cfg['Servers'][$i]['AllowNoPassword'] = true;
    $cfg['Servers'][$i]['CountTables'] = true;

    $i++;
}

$cfg['DefaultLang'] = 'en';
$cfg['DisplayDatabasesList'] = 1;
$cfg['ServerDefault'] = 1;
$cfg['GZipDump'] = false;
$cfg['BZipDump'] = false;
$cfg['AllowUserDropDatabase'] = true;
$cfg['AllowArbitraryServer'] = true;
$cfg['LoginCookieValidity'] = 60000;
$cfg['LeftFrameDBSeparator'] = '';
$cfg['LeftDisplayTableFilterMinimum'] = 100;
$cfg['UserprefsDisallow'] = array('LeftFrameDBSeparator');
$cfg['ShowPhpInfo'] = true;
$cfg['ShowAll'] = true;
$cfg['MaxRows'] = 100;
$cfg['Order'] = 'ASC';
$cfg['LimitChars'] = 30;
$cfg['PropertiesIconic'] = true;
$cfg['Import']['charset'] = 'utf-8';
$cfg['Import']['ods_col_names'] = true;
$cfg['Export']['quick_export_onserver'] = true;
$cfg['Export']['quick_export_onserver_overwrite'] = true;
$cfg['Export']['charset'] = 'utf-8';
$cfg['Export']['sql_include_comments'] = false;
$cfg['Export']['sql_drop_table'] = true;
$cfg['Export']['sql_utc_time'] = false;
$cfg['Export']['csv_columns'] = true;
$cfg['Export']['excel_columns'] = true;
$cfg['Export']['htmlword_columns'] = true;
$cfg['Export']['ods_columns'] = true;
$cfg['Export']['texytext_columns'] = true;

Setup ubuntu on VMWare Fusion 4

Posted: October 15th, 2011 | Author: | Filed under: System | No Comments »

This is how to set up a ubuntu dev box on VMWare Fusion 4.02.

1. Add new Linux 64 machine, then edit the config with more memory and cpu

2. After installing Ubuntu, install the necessary software

sudo apt-get install vim ssh git-core build-essential lamp-server^ phpmyadmin

3. Now add new group dev, put main user and www-data to the group, update umask

4. Mount VMWare Tools cd in top menu “Virtual Machine -> Install WMWare Tools”. It will ask you to download the iso if you haven’t got it locally. (Also, if you run into problem mounting the iso, try re-enable CD/DVD and select the linux.iso in drop down list – it will appear after you downloaded it)

5. Now mount the cd and install it in Linux

sudo mkdir /mnt/cdrom; sudo mount /dev/cdrom /mnt/cdrom;
sudo cp /mnt/cdrom/VMwareTools-xxxxxxxxx[tab to find this] ~/
cd
tar -xzvf VMwareTools-xxxxxxxxx[tab to find this]
cd vmwarexxxxxxxx[tab]
./vmware-install.pl
## Now just answer the question and let it compile

6. Shutdown, turn on “Sharing” and add your local folder on Mac

7. After reboot a /mnt/hgfs will appear, however not in correct ownership. http://communities.vmware.com/thread/328819 has some solution. But we will using a slightly different approach: mount another with our own:

sudo mkdir /mnt/host
# Edit /etc/rc.local and add the following line before "exit 0"
mount -t vmhgfs .host:/ /mnt/host -o rw,uid=33,gid=1001,sync

7update: ok the build-in share sucks, do a samba share on Mac instead.

8. Now to config fixed ip address for the virtual machine by its MAC address (config MAC address in VMware’s “Network Adapter -> Advanced Options”)

# On Mac host
sudo vim "/Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf"
# Add something like this ()
host <linux machine hostname> {
    hardware ethernet <MAC address of linux machine>;
    fixed-address <The static IP address you want>;
}
# Now modify your /etc/hosts with the new static ip

Geektool Scripts – Geeklets

Posted: October 7th, 2011 | Author: | Filed under: OS X | No Comments »

CPU Usage.glet
Date.glet
Quote of the day.glet
Time.glet
Top Processes.glet
Weather.glet


ShiftIt build

Posted: October 1st, 2011 | Author: | Filed under: OS X | No Comments »

This is a build based on fikovnik’s version.

By pressing hotkeys you can resize any window to one of the 10 position/size combinations. Of course this is mac only.