Skip to content

Instantly share code, notes, and snippets.


Leong Hean Hong hongster

View GitHub Profile
hongster / odbc.ini
Created May 14, 2020
Sample odbc.ini for Netezza
View odbc.ini
[ODBC Data Sources]
NZSQL = NetezzaSQL
;Path of a driver used for database connection
Driver = NetezzaSQL
;A decription used to identify the database connection properties.
Description = NetezzaSQL ODBC
hongster /
Created Aug 26, 2018
Scrape ballroom dance competition result from (HTML) result generated by Skating System Software.
from bs4 import BeautifulSoup
import urllib2
import re
import sys
import codecs
def process_folder(folder_url):
page = urllib2.urlopen(folder_url)
hongster / log-killer.php
Created Aug 21, 2018
Delete log files so that total size of all log files is kept within certain size limit.
View log-killer.php
#!/usr/bin/env php
/* This script is designed to delete logs files if it exceeds a defined size limit.
* Size limit is applied to all log files, instead of individual file.
* The logs are sorted by filename in reversed alphabetical order.
* Each file's size is counted and sum with previous file. If size limit is exceeded,
* subsequent files are deleted.
const MB = 1024 * 1024;

Keybase proof

I hereby claim:

  • I am hongster on github.
  • I am hongster ( on keybase.
  • I have a public key whose fingerprint is DAD6 71CB E980 8801 48B7 20C8 7C1C E5E3 11EC E1DC

To claim this, I am signing this object:

hongster /
Created Jan 4, 2016
Generate Primitive Pythagorean Triples using Euclid's formula.
Exercise in generate Primitive Pythagorean Triples using Euclid's formula.
import fractions
import math
def pythagorean_triple(s, t):
hongster / go_mem_usage.go
Last active Jan 11, 2018
Go runtime memory usage.
View go_mem_usage.go
package main
import (
func main() {
var memStats runtime.MemStats
hongster / tcp_timeout.go
Created Oct 2, 2015
Golang example on handling TCP connection and setting timeout.
View tcp_timeout.go
package main
import (
func handleConnection(conn net.Conn) {
hongster / rabbitmq-management.xml
Created Jul 8, 2015
Firewalld service configuration for RabbitMQ (web) management console. /etc/firewalld/services/rabbitmq-management.xml
View rabbitmq-management.xml
<?xml version="1.0" encoding="utf-8"?>
<short>RabbitMQ Management Console</short>
<description>Web interface for managing RabbitMQ</description>
<port protocol="tcp" port="15672"/>
hongster / rabbitmq.xml
Last active Aug 29, 2015
Firewalld service configuration for RabbitMQ server. /etc/firewalld/services/rabbitmq.xml
View rabbitmq.xml
<?xml version="1.0" encoding="utf-8"?>
<short>RabbitMQ Server</short>
<description>Robust messaging for applications</description>
<port protocol="tcp" port="5671"/>
<port protocol="tcp" port="5672"/>
hongster / build_number_gen.php
Last active Apr 12, 2019
Generating build number from git branch name and commit count.
View build_number_gen.php
* Generate a build number based on Git commit count and current branch.
* @return string Format: "{$branch}.{$commitCount}"
public function buildNumber()
$branch = exec('git rev-parse --abbrev-ref HEAD');
$commitCount = exec('git rev-list HEAD --count');