Skip to content

Instantly share code, notes, and snippets.

View djleonskennedy's full-sized avatar
🌌
Loading...

Yuriy Yakovenko djleonskennedy

🌌
Loading...
View GitHub Profile
@djleonskennedy
djleonskennedy / glog
Created April 15, 2022 10:15 — forked from yize/glog
Beauty & useful git log
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"
@djleonskennedy
djleonskennedy / lca.ts
Created September 22, 2020 10:59
Lowest Common Ancestor
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)
@djleonskennedy
djleonskennedy / fib_dynamic_programming.js
Last active September 15, 2020 07:18
Dynamic Programming example
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)) {
// 'use strict'
let callback = null;
function observe(data) {
const subscribers = {};
return new Proxy(data, {
set(obj, key, value) {
obj[key] = value;
if (subscribers[key]) {
[
'babel-plugin-rewrite-require',
{
aliases: {
crypto: 'crypto-browserify',
stream: 'readable-stream',
vm: 'vm-browserify',
},
},
],
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;
@djleonskennedy
djleonskennedy / metro-cache.sh
Created January 21, 2020 11:38
metro cache
sudo chown -R $USER:$GROUP /tmp/metro-cache
@djleonskennedy
djleonskennedy / wathcman-ubuntu-19.sh
Created January 21, 2020 11:06
wathcman ubuntu 19+
sudo apt install pkg-config
sudo apt install libssl-dev
./autogen.sh
./configure --without-python --without-pcre --enable-lenient
make
sudo make install
@djleonskennedy
djleonskennedy / zone_demo.ts
Last active August 19, 2019 09:43
demo to show, how to use Zone Js
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) {
@djleonskennedy
djleonskennedy / openconnect-totp.sh
Last active April 15, 2021 09:28
connect to vpn via "openconnect" automatically with OTP
#!/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