Useful commands (all auth should be md5)
sudo apt install postgresql
sudo vi /etc/postgresql/10/main/pg_hba.conf
sudo systemctl restart postgresql
| const input = [1,2,3,4]; | |
| const oldFunc = (element, callback) => { | |
| const r = Math.floor(200 * Math.random()); | |
| setTimeout( () => { | |
| console.log('oldFunc End', element); | |
| callback(element + "|" + r); | |
| }, r); | |
| }; |
| #!/bin/bash | |
| IFS=$'\n' | |
| REPO="libero/reviewer-client" | |
| for f in `gh issue list --repo ${REPO}` | |
| do | |
| title=$(echo $f | cut -d $'\t' -f2-) | |
| num=$(echo $f | cut -d $'\t' -f1) | |
| body="Cloned from ${REPO}/issues/${num}" |
| import { Event } from './types'; | |
| import uuid = require('uuid'); | |
| const expectedEventProperties = { | |
| eventType: true, | |
| id: true, | |
| created: true, | |
| payload: true, | |
| }; |
| const log = console; | |
| const sleep = async ms => { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| }; | |
| const asyncFunc1 = async () => { | |
| log.log('f1 Start'); | |
| await sleep(2000); | |
| log.log('f1 End'); |
| import { transform, isEqual, isObject } from 'lodash'; | |
| /** | |
| * Source: https://gist.github.com/Yimiprod/7ee176597fef230d1451#gistcomment-2565071 | |
| * Deep diff between two object, using lodash | |
| * @param {Object} object Object compared | |
| * @param {Object} base Object to compare with | |
| * @return {Object} Return a new object who represent the diff | |
| */ | |
| function difference(object, base) { |
| git checkout develop | |
| git pull | |
| git checkout <my-branch-that-needs-rebasing> | |
| git fetch origin | |
| git rebase origin/develop | |
| git status | |
| git push --force |
| #!/usr/bin/env bash | |
| # | |
| # Usage: pass in the host or host:port as the first argument | |
| # | |
| # This will then wait for a max of 5 mins for the application to start | |
| # | |
| RESOURCE=http://$1/assets/app.js | |
| CMD="timeout 1s curl -s ${RESOURCE}" |
| # Build using latest node v9 | |
| FROM node:9 as builder | |
| RUN mkdir /build | |
| WORKDIR /build | |
| COPY package.json ./ | |
| COPY yarn.lock ./ | |
| COPY client client |
| fs = require('fs') | |
| /* | |
| * Wrap old-style callback with promise explicitly created... | |
| */ | |
| const readfolderPromise = (folder) => { | |
| if (folder === undefined) { | |
| folder = process.cwd() | |
| } | |
| console.log(folder) |