Skip to content

Instantly share code, notes, and snippets.

View kccheung's full-sized avatar
🎯
Focusing

David C kccheung

🎯
Focusing
  • Hong Kong SAR China
View GitHub Profile
@hube
hube / ruby-intro.rb
Last active August 29, 2015 13:57
Intro Ruby Code
puts "Hello world!"
def say_hello
puts "Hello world!"
end
say_hello
class Greeter
def initialize(name)
@kccheung
kccheung / .ackrc
Last active August 29, 2015 14:06 — forked from theaboutbox/.ackrc
--type-add=css=.sass,.less,.scss
--type-add=ruby=.rake,.rsel,.builder,.thor
--type-add=html=.haml,.html.erb,.html.haml
--type-add=js=.js.erb,.coffee
--type-set=cucumber=.feature
--type-set=c=.c,.cpp,.ino,.pde,.h
--ignore-dir=vendor
--ignore-dir=log
--ignore-dir=tmp
--ignore-dir=doc
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
  • 🎨 when improving the format/structure of the code
  • 🚀 when improving performance
  • ✏️ when writing docs
  • 💡 new idea
  • 🚧 work in progress
  • ➕ when adding feature
  • ➖ when removing feature
  • 🔈 when adding logging
  • 🔇 when reducing logging
  • 🐛 when fixing a bug
@hktonylee
hktonylee / domMouseClickEvent.js
Last active December 13, 2015 23:39
Use Javascript to fire DOM mouse click events
function fireEvent(obj,evt) {
var evObj = document.createEvent('MouseEvents');
evObj.initEvent(evt, true, false );
obj.dispatchEvent(evObj);
}
// fireEvent(document.getElementById('someID'), 'click');
@hktonylee
hktonylee / Django Multilingual Model.md
Last active December 20, 2015 01:49
django-hvad Sample Code

I tried the first 2 items from Django Packages. And I found that django-hvad is better for me.

@hktonylee
hktonylee / mysqlOperations.sh
Last active December 20, 2015 01:49
MySQL Basic Operations
# create user
mysql -uroot -e "create user '$YOUR_NAME'@'localhost' identified by '$YOUR_PASS'"
# create database
mysql -uroot -e "create database $YOUR_DB_NAME character set utf8 collate utf8_general_ci;"
# grant privileges
mysql -uroot -e "grant all privileges on $YOUR_DB_NAME.* to '$YOUR_NAME'@'localhost' with grant option;"
@kccheung
kccheung / docker-log.sh
Created August 11, 2016 04:08 — forked from yarcowang/docker-log.sh
simple bash script to show log for a docker image
#!/usr/bin/env bash
DOCKER=`which docker`
usage()
{
echo "Usage: $(basename $0) [-l num] IMAGE"
exit 0
}
@monkeydom
monkeydom / applestorede.sh
Created March 24, 2011 21:02
Apple store is down script
#!/bin/bash
WaitForDown=true
while true; do
StoreUp=`curl -s http://store.apple.com/de | grep "Mac kaufen" | wc -l`
if [ $StoreUp -eq 0 ]; then
if $WaitForDown; then
@drx
drx / mbp.py
Created June 12, 2012 13:42
Tiny script to scrape Apple Online Store every second and check for changes in MacBook availability
import urllib2
import re
import time
import pycurl
import StringIO
#url = "http://78.10.81.103:19100/mbp.html"
url = "http://store.apple.com/pl/browse/home/shop_mac/family/macbook_pro/select"
prev_delivery = (None, None)