Skip to content

Instantly share code, notes, and snippets.

View wonglkd's full-sized avatar

Daniel Wong wonglkd

View GitHub Profile
@wonglkd
wonglkd / llc_output
Last active November 3, 2015 07:33
Linker output
$ ../llvm/Build/bin/llc -filetype=obj -o fetch-soaap.o fetch.soaap $ ../llvm/Build/bin/clang -o fetch-soaap fetch-soaap.o
/usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
/usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
/usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
/usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
/usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
/usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
fetch-soaap.o: In function `DigestCalcHA1':
fetch.soaap:(.text+0xbcfc): undefined reference to `MD5Init'
fetch.soaap:(.text+0xbd19): undefined reference to `MD5Update'
@wonglkd
wonglkd / soaap_output
Created November 3, 2015 07:33
SOAAP output
$ ../soaap/Build/Release/bin/soaap -o fetch.soaap fetch_c.ll --soaap-list-sandboxed-funcs --soaap-infer-fp-targets --soaap-dump-rpc-graph --soaap-sandbox-platform=capsicum --soaap-emulate-performance
* Running Soaap Pass
* Processing command-line options
* Finding class hierarchy (if there is one)
* Finding sandboxes
* Building basic callgraph
WARNING: Function "fprintf" is unresolved. Its behaviour will not be analysed.
WARNING: Function "socketpair" is unresolved. Its behaviour will not be analysed.
WARNING: Function "perror" is unresolved. Its behaviour will not be analysed.

Keybase proof

I hereby claim:

  • I am wonglkd on github.
  • I am wonglkd (https://keybase.io/wonglkd) on keybase.
  • I have a public key whose fingerprint is 7DCA 8B5A DE0B F45B 4CC5 B013 B8FE 1C9E 26B0 A6F3

To claim this, I am signing this object:

@wonglkd
wonglkd / portopen.sh
Created November 25, 2016 05:05
Test if port is open
# on server
# tips: -u for UDP,
nc -l <port>
# on client
nc <ip> <port>
@wonglkd
wonglkd / model.py
Created January 5, 2017 14:03
Bypass sample weights
# Implement REINFORCE rule by using crossentropy
# + (reward - baseline) as sample_weight.
self.model.compile(loss='categorical_crossentropy', optimizer=Adam(lr=self.lr))
# Adapted from model.compile: redo the computation of loss.
loss_functions = [objectives.get('categorical_crossentropy')]
total_loss = None
for i in range(len(self.model.outputs)):
import pdb, sys, traceback
def info(type, value, tb):
traceback.print_exception(type, value, tb)
pdb.pm()
sys.excepthook = info
import pdb, sys, traceback
def info(type, value, tb):
traceback.print_exception(type, value, tb)
pdb.pm()
sys.excepthook = info
scikit-learn==0.18.1
pandas==0.20.1
Keras>=2.0.4
numpy>=1.12.1
scipy>=0.19.0
tensorflow>=1.1.0
spacy>=1.8.2
# sacred==0.7.0
git+https://github.com/IDSIA/sacred.git@5a823657d824103cbbe09177a3aaf706c557ce55#egg=sacred
pymongo>=3.4.0
@wonglkd
wonglkd / spell_check.sh
Last active February 7, 2018 04:40
spell_check.sh
#!/bin/bash
# usage: bash ../utils/spell-check.sh
# setup:
# brew install hunspell
# wget https://raw.githubusercontent.com/wooorm/dictionaries/master/dictionaries/en-US/index.dic -O ~/Library/Spelling/en_US.dic
# wget https://raw.githubusercontent.com/wooorm/dictionaries/master/dictionaries/en-US/index.aff -O ~/Library/Spelling/en_US.aff
#
hunspell -l -t *.tex | sort | uniq > ../utils/misspelled.tmp
sort ../utils/dictionary -o ../utils/dictionary
comm -23 ../utils/misspelled.tmp ../utils/dictionary