Skip to content

Instantly share code, notes, and snippets.

@seoh
seoh / eckey.js
Created April 15, 2019 11:30
address from pkey
// from https://etherworld.co/2017/11/17/understanding-the-concept-of-private-key-public-key-and-address-in-ethereum-blockchain/
const EC = require('elliptic').ec
const BN = require('bn.js')
const ec = new EC('secp256k1')
const keccak256 = require('js-sha3').keccak256
const G = ec.g
const privateKey = process.argv[2]
const pk = new BN(privateKey)
@seoh
seoh / EitherT example.ipynb
Created March 4, 2019 13:32
EitherT example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@seoh
seoh / .vimrc
Created January 21, 2019 09:43
call plug#begin('~/.vim/plugged')
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/seoul256.vim'
Plug 'junegunn/goyo.vim'
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a fish pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@seoh
seoh / slides.md
Last active May 25, 2020 22:22
Scala Night 2018
@seoh
seoh / parse.js
Created June 10, 2016 05:14
JSON to QueryString
const prefixes = (prev, next) => prev ? `${prev}[${next}]` : next
const serialize = (key, value, prefix = '') => {
switch(value.constructor.name) {
case "Array": return value.map((obj, i) => serialize(i+ "", obj, prefixes(prefix, key))).join('&')
case "Object": return parse(value, prefixes(prefix, key))
default: return prefixes(prefix, key) + '=' + value
}
}
@seoh
seoh / wtf.js
Created August 26, 2015 04:13
kinds of chaining-indentation
/**
* so many type of chaining
*/
//// about dot-indentation.
// type 1-1. align with dot.
const ret = obj.method1()
.method2()
.method3()
.value();
@seoh
seoh / mole1.js
Last active August 29, 2015 14:26
Simple Monadic Parser using JavaScript
// https://www.cs.nott.ac.uk/~gmh/monparsing.pdf
//
// type Parser[T] = String -> [(T, String)]
//
/** lookahead token
*
* Parser -> Parser

Keybase proof

I hereby claim:

  • I am seoh on github.
  • I am seoh (https://keybase.io/seoh) on keybase.
  • I have a public key whose fingerprint is 3F6B 402B C421 9BD0 D5AE 3C27 8DFA C8F5 E0E6 BA93

To claim this, I am signing this object:

@seoh
seoh / unicode_name.js
Created June 23, 2015 12:35
get name of unicode symbol
function code(name) {
return "0x" + name.charCodeAt(0).toString(16);
}
window.open("http://unicode.org/cldr/utility/character.jsp?a=00" + code(prompt()));