Skip to content

Instantly share code, notes, and snippets.

View kendricktan's full-sized avatar

Kendrick Tan kendricktan

View GitHub Profile
@kendricktan
kendricktan / init.vim
Last active December 16, 2018 05:27
Personal NVim config file (primarily for Haskell development)
" Use Vim settings, rather than Vi Settings
set nocompatible
"************************************************
"" Vim-Plug
"************************************************
let nvimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
if !filereadable(nvimplug_exists)
@kendricktan
kendricktan / configuration.nix
Last active February 7, 2024 01:58
NixOS 18.03 (To get zsh working, `nixos-rebuild switch; cp /etc/zsh ~/.zshrc; remove first two lines of zshrc`)
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
@kendricktan
kendricktan / ExceptT_example.hs
Created July 19, 2018 15:20
ExceptT minimal usage example
import Control.Monad.Except
import Control.Monad.Identity
data MyError = InvalidNumber deriving Show
data MySuccess = CorrectNumber | NotACorrectNumber deriving Show
runMyMonad = runIdentity . runExceptT
type MyMonad = ExceptT MyError Identity MySuccess
@kendricktan
kendricktan / youtube-dl-music.sh
Created July 30, 2018 13:52
Download youtube music via youtube-dl
youtube-dl --extract-audio --audio-format mp3 -o '%(title)s.%(ext)s' <URL>
@kendricktan
kendricktan / openssl_esp8266_make_cert.sh
Created September 3, 2018 12:08
Generate Cert and RSA Key for ESP8266
# Key
openssl genrsa -out <domain-name>.key 2048
# Cert
openssl req -new -x509 -key <domain-name>.key -out <domain-name>.cert -days 3650 -subj /CN=<domain-name>
# https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino
@kendricktan
kendricktan / Maybe.py
Last active April 11, 2019 06:26
Maybe Monads in Python
from abc import ABC, abstractmethod
class Applicative(ABC):
@abstractmethod
def fmap(self, f):
raise Exception('Not implemented!')
class Functor(ABC):
@kendricktan
kendricktan / Maybe.coco
Created January 5, 2019 03:04
Maybe Monad COCO
import math
class Maybe
data Just(n) from Maybe
data Nothing() from Maybe
@addpattern(fmap)
def fmap(f, Nothing()) = Nothing()
@kendricktan
kendricktan / resources.txt
Last active April 8, 2020 20:26
RangeProof Resources
# Papers
## BulletProof Original Paper
https://eprint.iacr.org/2017/1066.pdf
# Things Intentionally Left Out
## Fiat Shamir
https://en.wikipedia.org/wiki/Feige%E2%80%93Fiat%E2%80%93Shamir_identification_scheme
http://cryptowiki.net/index.php?title=Fiat_-_Shamir_protocol
## Pederson Commitments
https://crypto.stackexchange.com/questions/9704/why-is-the-pedersen-commitment-computationally-binding
@kendricktan
kendricktan / load_nvm
Created October 24, 2019 00:05
Lazy load NVM
declare -a NODE_GLOBALS=(`find ~/.nvm/versions/node -maxdepth 3 -type l -wholename '*/bin/*' | xargs -n1 basename | sort | uniq`)
NODE_GLOBALS+=("node")
NODE_GLOBALS+=("nvm")
load_nvm () {
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
}