Skip to content

Instantly share code, notes, and snippets.

View ppeeou's full-sized avatar
🎯
Focusing

hyunwoo jo ppeeou

🎯
Focusing
View GitHub Profile
@ppeeou
ppeeou / omnuum_version.json
Last active April 12, 2022 06:12
omnuum_version
{
"command": "1.0.1"
}
const fetch = require("node-fetch");
const fs = require("fs");
const url = "your url";
(async () => {
const response = await fetch(url);
const buffer = await response.buffer();
#include "stdio.h"
#include <stack>
#include <vector>
#include <iostream>
#include "string"
using namespace std;
struct Comparator
{
// -- simple
function isIterator(obj) {
return !!obj && !!obj[Symbol.iterator];
}
function allSettled(iterable) {
if (!isIterator(iterable)) {
throw new Error('[allSettled] first param must be iterable');
}
Promise
.all([promise1,promise2,promise3])
.then(fn)
.catch(fn)
const promise1 = Promise.resolve(3);
const promise2 = new Promise((resolve, reject) => setTimeout(reject, 100, 'foo'));
const promises = [promise1, promise2];
Promise.allSettled(promises)
.then((results) => results.forEach((result) => console.log(result.status)));
// expected output:
// "fulfilled"
// "rejected"
const curry = f => (a, ..._) => _.length > 0
? f(a, ..._)
: (..._) => f(a, ..._);
const isIter = iter => iter && iter[Symbol.iterator];
const toIter = iter => isIter(iter) ? iter[Symbol.iterator]() : function* () { }
const go1 = (a, f) => a instanceof Promise ? a.then(f) : f(a);
// const go2 = (acc, value, f) => value instanceof Promise
@ppeeou
ppeeou / python_install.sh
Created March 28, 2019 09:15
python install
## ssl issue
apt-get install libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev libtk8.5 libgdm-dev libdb4o-cil-dev libpcap-dev -y
## python version 3.6.8
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
tar -xf Python-3.6.8.tar.xz
/tmp/python-temp/Python-3.6.8/configure --enable-loadable-sqlite-extensions && \
make && make install
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build_c",
"type": "shell",
"command": "gcc",
"args": [
@ppeeou
ppeeou / deepFindValue.js
Last active February 20, 2019 04:28
deep obj find value from key
function deepFindValue(obj, value) {
let results = [];
return function recur(obj, value) {
for (let key of Object.keys(obj)) {
if (typeof obj[key] === 'object') {
recur(obj[key], value)
} else if (obj[key] === value) {