Skip to content

Instantly share code, notes, and snippets.

Avatar
🌌
Loading...

Yuriy Yakovenko djleonskennedy

🌌
Loading...
View GitHub Profile
@djleonskennedy
djleonskennedy / glog
Created Apr 15, 2022 — forked from yize/glog
Beauty & useful git log
View glog
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 Sep 22, 2020
Lowest Common Ancestor
View lca.ts
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 Sep 15, 2020
Dynamic Programming example
View fib_dynamic_programming.js
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
// '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
[
'babel-plugin-rewrite-require',
{
aliases: {
crypto: 'crypto-browserify',
stream: 'readable-stream',
vm: 'vm-browserify',
},
},
],
View gist:051625a1e0f10200d4c7b8442e6f60e9
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
sudo chown -R $USER:$GROUP /tmp/metro-cache
View wathcman-ubuntu-19.sh
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 Aug 19, 2019
demo to show, how to use Zone Js
View zone_demo.ts
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 Apr 15, 2021
connect to vpn via "openconnect" automatically with OTP
View openconnect-totp.sh
#!/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