Skip to content

Instantly share code, notes, and snippets.

View angch's full-sized avatar

Ang Chin Han angch

  • Kuala Lumpur, Malaysia
View GitHub Profile
@angch
angch / malaysia.districts.geojson
Created March 31, 2017 11:22
geojson of malaysia's districts (mukim) converted from gadm.org for convenience
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
package main
/////////////////////////////////////////////////////////////////
//Code generated by chidley https://github.com/gnewton/chidley //
/////////////////////////////////////////////////////////////////
import (
"bufio"
"compress/bzip2"
"compress/gzip"

Keybase proof

I hereby claim:

  • I am angch on github.
  • I am angch (https://keybase.io/angch) on keybase.
  • I have a public key ASBOyuTBV7Rm5P7UC0Kg-Hh7OfX_KU1i_B23nG1t9_KbYAo

To claim this, I am signing this object:

package main
import (
"fmt"
"os"
)
var bitCounts = []uint8{}
func init() {
@angch
angch / factorial.go
Last active November 1, 2016 10:37
Naive Go factorial. Can't run in Go playground, too slow.
// real 0m0.638s
// user 0m0.621s
// sys 0m0.015s
package main
import (
"fmt"
"math/big"
)
@angch
angch / weather.pl
Created September 5, 2016 12:01
Attempting to simply JSON extraction ala http://objectpath.org/ in Perl6.
use v6;
use Net::HTTP::GET;
use JSON::Fast;
my $appid = %*ENV{'APPID'} or die "Need APPID in env var from openweathermap.org";
my $contents;
if (1) {
my $response = Net::HTTP::GET("http://api.openweathermap.org/data/2.5/box/city?bbox=12,32,15,37,10&cluster=yes&appid=" ~ $appid);
use v6;
my $employees = [
{firstname=>'Joe', lastname=>'Bloggs', grade=>3},
{firstname=>'Ola', lastname=>'Nordmann', grade=>3},
{firstname=>'Kari', lastname=>'Nordmann', grade=>2},
{firstname=>'Jane', lastname=>'Doe', grade=>4},
{firstname=>'John', lastname=>'Doe', grade=>3},
];
<?php
$transaction = [
'id' => 1795,
'case_number' => 'TX2015-0123',
'property' => [
'id' => 69134,
'propertyType' => [
'id' => 1,
'name' => 'Residential'
],
package main
import (
"fmt"
"math/big" // Seems like a copout
)
func main() {
s := big.NewInt(1)
s.Lsh(s, 1000)
# Yes, I cheated, after getting the formula wrong.
f = [1]
def fac(n):
if n >= len(f):
f.append(fac(n-1) * n)
return f[n]
n = 20
print fac(n*2) / (fac(n)*fac(n))