Skip to content

Instantly share code, notes, and snippets.

View kkdai's full-sized avatar

Evan Lin kkdai

View GitHub Profile
@yinghau76
yinghau76 / test-1.S
Created September 12, 2015 06:06
Test arithmetic on Go custom integer type
~/tmp $ go build -gcflags=-S test-1.go | more
# command-line-arguments
"".main t=1 size=256 value=0 args=0x0 locals=0x70
0x0000 00000 (/Users/patrick/tmp/test-1.go:7) TEXT "".main(SB), $112-0
0x0000 00000 (/Users/patrick/tmp/test-1.go:7) MOVQ (TLS), CX
0x0009 00009 (/Users/patrick/tmp/test-1.go:7) CMPQ SP, 16(CX)
0x000d 00013 (/Users/patrick/tmp/test-1.go:7) JLS 231
0x0013 00019 (/Users/patrick/tmp/test-1.go:7) SUBQ $112, SP
0x0017 00023 (/Users/patrick/tmp/test-1.go:7) FUNCDATA $0, gclocals·7d2d5fca80364273fb07d5820a76fef4(SB)
0x0017 00023 (/Users/patrick/tmp/test-1.go:7) FUNCDATA $1, gclocals·5ef976c2593056b9243adf402ae9d952(SB)
@honza
honza / parse.py
Created February 24, 2012 03:03
Tim Hortons: XML => JSON
"""
Convert an XML list of Tim Hortons restaurant locations to JSON
Usage: python parse.py sourcefile destfile
E.g.: python parse.py locations.xml locations.json
"""
import json
import sys
try:
@yyjim
yyjim / gist:0b13e823646921827220
Created April 1, 2015 09:01
taipei opendata test
NSURL *url = [NSURL URLWithString:@"http://opendata.dot.taipei.gov.tw/opendata/alldescriptions.json"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
unsigned long big5 = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingBig5_HKSCS_1999);
NSString *json = [[NSString alloc] initWithData:data encoding:big5];
NSError *error;
NSDictionary *dictionary =
[NSJSONSerialization JSONObjectWithData:[json dataUsingEncoding:NSUTF8StringEncoding]
ln -s $(go list -f "{{.Dir}}" github.com/c9s/fsrename/fsrename) \
$(go list -f "{{.Root}}" github.com/c9s/fsrename/fsrename)/src/fsrename
@akshatmittal
akshatmittal / help.txt
Last active July 7, 2016 03:40
Facebook Look Back video extractor.
Hey there,
Use the main.js to download your video, instructions included in that file.
(File is here on this page itself, either above or below this)
If in case, Facebook didn't made a video for you, read this:
http://on.fb.me/LookBackNoVideo
If you got your video once, and you deleted a timeline post (or anything else)
which made the video disappear from the page, you can still retrieve the
file from your browser cache.
anonymous
anonymous / vmware-tech-day-2016-taiwan.md
Created June 23, 2016 13:37
VMware Technology Day 2016 Taiwan
  • CPU Performance
    • Ready time need to know
      • High CPU usage -> Best Virtualization utilization for enterprise, not really the CPU resource is exhausted
    • Higher Ready time -> Wait for Physical CPU Ready for a long time -> may be the CPU exhausted with High CPU usage
    • resxtop
      • V for show vm only
      • e for show the world of specified vm
    • Not to use SMP (1 CPU 1 vCPU)
  • Memory Performance
  • vm memory usage strategy: on demend -> will not return back memory
@zhasm
zhasm / xml2json.py
Created December 18, 2012 14:57 — forked from anonymous/xml2json.py
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""xml2json.py Convert XML to JSON
Relies on ElementTree for the XML parsing. This is based on
pesterfish.py but uses a different XML->JSON mapping.
The XML->JSON mapping is described at
http://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html
import simplejson as json
import lxml
class objectJSONEncoder(json.JSONEncoder):
"""A specialized JSON encoder that can handle simple lxml objectify types
>>> from lxml import objectify
>>> obj = objectify.fromstring("<Book><price>1.50</price><author>W. Shakespeare</author></Book>")
>>> objectJSONEncoder().encode(obj)
'{"price": 1.5, "author": "W. Shakespeare"}'
"""
@ekampf
ekampf / setup_kafka.sh
Last active November 29, 2017 17:41
Setup Kafka (0.8.0) on OSX
brew install sbt
cd /tmp
wget http://apache.spd.co.il/kafka/0.8.0/kafka_2.8.0-0.8.0.tar.gz
tar -zxvf kafka_2.8.0-0.8.0.tar.gz -C /usr/local/
cd /usr/local/kafka_2.8.0-0.8.0
sbt update
sbt package
1. 編輯你的fullchain.pem vim /etc/letsencrypt/live/blaha.tw/fullchain.pem
2. 把這個intermediate certificate(https://letsencrypt.org/certs/letsencryptauthorityx1.pem.txt)加入fullchain的兩個certificate中間
3. restart你的webserver