Skip to content

Instantly share code, notes, and snippets.

View kendricktan's full-sized avatar

Kendrick Tan kendricktan

View GitHub Profile
@kendricktan
kendricktan / gist:ae0add7c6cc7e3746cf3
Created September 5, 2015 09:08
NCSS 2015 CCG Parsing Test cases
Enter categories: PP (S\NP)/NP NP N conj N NP (S\NP)/NP NP/N N/N
+-----------+
| |
+-----------+-----------+
| | |
+-----------+-----------+-----------+
| | | |
+-----------+-----------+-----------+-----------+
| | | | |
+-----------+-----------+-----------+-----------+-----------+
@kendricktan
kendricktan / gabor_filter.py
Created May 16, 2016 01:07
Gabor kernel filter example in python
import numpy as np
import cv2
# cv2.getGaborKernel(ksize, sigma, theta, lambda, gamma, psi, ktype)
# ksize - size of gabor filter (n, n)
# sigma - standard deviation of the gaussian function
# theta - orientation of the normal to the parallel stripes
# lambda - wavelength of the sunusoidal factor
# gamma - spatial aspect ratio
# psi - phase offset
# Mouse event handler for get_hsv
def on_mouse(self, event, x, y, flag, param):
if event == cv2.EVENT_LBUTTONDBLCLK:
# Circle to indicate hsv location, and update frame
cv2.circle(self.img_debug, (x, y), 3, (0, 0, 255))
cv2.imshow('hsv_extractor', self.img_debug)
# Print values
values = self.hsv_frame[y, x]
print('H:', values[0], '\tS:', values[1], '\tV:', values[2])
@kendricktan
kendricktan / META_TALKS.md
Created April 9, 2017 20:10 — forked from adrianmcli/META_TALKS.md
List of meta talks about programming, design, and human understanding.
@kendricktan
kendricktan / xorg.conf
Created July 6, 2017 12:52
Xorg Eth Setup
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 381.22 (buildmeister@swio-display-x86-rhel47-02) Thu May 4 01:29:00 PDT 2017
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
def k_competitive_layer(tensor, top_k, alpha, cuda=False):
"""
https://arxiv.org/pdf/1705.02033.pdf
Args:
tensor: Tensor
top_K: int
alpha: hyper param
"""
def k_update(tensor_, indices, top_k, alpha, largest=True, cuda=False):
@kendricktan
kendricktan / load_walletdat_bitcoin_zencash.js
Created August 9, 2017 06:13
Load bitcoin /zencash wallet.dat file in javascript
fs = require('fs')
fs.readFile('/home/kendrick/.zen/wallet.dat', function (err, data) {
var re = /\x30\x81\xD3\x02\x01\x01\x04\x20(.{32})/gm
var dataHexStr = data.toString('latin1')
var privateKeys = dataHexStr.match(re)
privateKeys = privateKeys.map(x => x.replace('\x30\x81\xD3\x02\x01\x01\x04\x20', ''))
privateKeys.map(x => console.log(Buffer.from(x, 'latin1').toString('hex')))
console.log('Found ' + privateKeys.length + ' keys')
@kendricktan
kendricktan / capsule_networks.py
Last active August 17, 2021 17:12
Clean Code for Capsule Networks
"""
Dynamic Routing Between Capsules
https://arxiv.org/abs/1710.09829
"""
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchvision.transforms as transforms
@kendricktan
kendricktan / am_zip_w_pwd_install.sh
Last active December 12, 2017 12:40
archieve manager unzip zip files ubuntu with password
sudo apt-get install p7zip p7zip-full
@kendricktan
kendricktan / Risk of Rain Save.ini
Last active January 8, 2023 20:44
Risk of Rain 100% Save.ini (linux its ~/.config/Risk of Rain), not in steam folder)
[Achievement]
achievement_progress14=30
achievement_progress15=370604
achievement_progress16=2606
achievement_progress20=30
achievement_progress23=944
achievement_progress33=31645
achievement_progress35=455
achievement_progress41=34
achievement_progress47=74