Skip to content

Instantly share code, notes, and snippets.

View ngshaohui's full-sized avatar

Shao Hui ngshaohui

  • Singapore
View GitHub Profile
@ngshaohui
ngshaohui / KDTree.spec.ts
Last active April 5, 2020 02:04
Balanced KDTree implementation in Typescript
import { KDTree, DistanceFunc } from './KDTree'
import { expect } from 'chai'
import 'mocha'
interface Point {
x: number
y: number
}
const pointList: Point[] = [
@ngshaohui
ngshaohui / CTF.md
Created June 18, 2019 02:27
ctf writeup for cddc

Just Console Log

Aspects of this challenge

  • reverse engineering + crypto
  • re: source is obfuscated with bad variable and function names
  • crypto: aes library is imported, and CBC method is called
  • need to understand javascript scoping

Stepping through the problem

1. Identify unused code

@ngshaohui
ngshaohui / kd-tree.py
Created December 9, 2018 08:17
kd tree for BusArrivalBot
#Helper function for the getNearest function
#isOdd should start as true (counting first level as 1)
#curNode starts from root
#searches for nearest stop to query that is not already in the blacklist
def getNearestH(self, curNode, isOdd, queryPoint, champion, blacklist):
if curNode == None: #base case
return champion
else: #get distance of queryPoint to current stop
stopLocation = (curNode.data["Latitude"], curNode.data["Longitude"])