View glog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias glog="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" |
View lca.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.clear(); | |
class TNode { | |
public left: TNode|undefined; | |
public right: TNode|undefined; | |
constructor(public value: number) {} | |
} | |
const root = new TNode(1) | |
const n2 = new TNode(2) |
View fib_dynamic_programming.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fib(n) { | |
if(n === 1 || n === 2) { | |
return 1; | |
} | |
return fib(n - 1) + fib(n - 2); | |
} | |
function fibMemo(n , memo) { | |
if(memo.get(n)) { |
View reactivity.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 'use strict' | |
let callback = null; | |
function observe(data) { | |
const subscribers = {}; | |
return new Proxy(data, { | |
set(obj, key, value) { | |
obj[key] = value; | |
if (subscribers[key]) { |
View gist:258d30285d1a7e844ce1c6bfa6023ade
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
'babel-plugin-rewrite-require', | |
{ | |
aliases: { | |
crypto: 'crypto-browserify', | |
stream: 'readable-stream', | |
vm: 'vm-browserify', | |
}, | |
}, | |
], |
View gist:051625a1e0f10200d4c7b8442e6f60e9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (__DEV__) { | |
global.XMLHttpRequest = global.originalXMLHttpRequest ? | |
global.originalXMLHttpRequest : | |
global.XMLHttpRequest; | |
global.FormData = global.originalFormData ? | |
global.originalFormData : | |
global.FormData; | |
global.Blob = global.originalBlob ? | |
global.originalBlob : | |
global.Blob; |
View metro-cache.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo chown -R $USER:$GROUP /tmp/metro-cache |
View wathcman-ubuntu-19.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install pkg-config | |
sudo apt install libssl-dev | |
./autogen.sh | |
./configure --without-python --without-pcre --enable-lenient | |
make | |
sudo make install |
View zone_demo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'zone.js' | |
import {Subject} from 'rxjs'; | |
const render = new Subject(); | |
const input = document.querySelector('#input') as HTMLInputElement; | |
Zone.current.fork({ | |
name: 'my first cool zone', | |
onInvokeTask(parentZoneDelegate, _, targetZone, task, applyThis, applyArgs) { |
View openconnect-totp.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PASSWORD=<userpassword> | |
BASE32_TOKEN=<BASE32 SECRET> | |
HOST=vpn.some.com | |
# topt token generation | |
# tools can be get here https://www.nongnu.org/oath-toolkit/ | |
# also don't forget to set current time | |
# this method is using is in case if "token" and "password" swapped |
NewerOlder