Skip to content

Instantly share code, notes, and snippets.

var Promise = require('bluebird');
const path = require('path');
const j = path.join;
const fs = Promise.promisifyAll(require('fs-extra'));
const wiredep = require('wiredep');
const home = require('user-home');
const hashCacheFile = j(home, '.quikr', 'buildCache.json');
const hasher = require('folder-hash');
const _console_log_ = console.log;
const _console_info_ = console.info;
@pwang2
pwang2 / publish.sh
Last active October 21, 2016 02:59
#!/bin/bash
# script to publish the related version to npm
function replaceJsonProp {
replaceInFile $1 '"('$2')"[ ]*:[ ]*"'$3'"' '"\1": "'$4'"'
}
function replaceInFile {
sed --in-place=.tmp -E "s/$2/$3/" $1
rm $1.tmp
}
'use strict';
var fork = require('child_process').fork,
guid = require('mout/random/guid'),
log = require('quikr-log')(),
_ = require('underscore'),
Promise = require('bluebird'),
cpus = require('os').cpus(),
path = require('path'),
QUEUE_LIMIT = 32,
DEFAULT_TIMEOUT = 20000; //ms
We can't make this file beautiful and searchable because it's too large.
index,airportname,city,country,iata,icao,latitude,longitude,altitude,timezone,dst,tzregion,type,source
1,"Goroka Airport","Goroka","Papua New Guinea","GKA","AYGA",-6.081689834590001,145.391998291,5282,10,"U","Pacific/Port_Moresby","airport","OurAirports"
2,"Madang Airport","Madang","Papua New Guinea","MAG","AYMD",-5.20707988739,145.789001465,20,10,"U","Pacific/Port_Moresby","airport","OurAirports"
3,"Mount Hagen Kagamuga Airport","Mount Hagen","Papua New Guinea","HGU","AYMH",-5.826789855957031,144.29600524902344,5388,10,"U","Pacific/Port_Moresby","airport","OurAirports"
4,"Nadzab Airport","Nadzab","Papua New Guinea","LAE","AYNZ",-6.569803,146.725977,239,10,"U","Pacific/Port_Moresby","airport","OurAirports"
5,"Port Moresby Jacksons International Airport","Port Moresby","Papua New Guinea","POM","AYPY",-9.443380355834961,147.22000122070312,146,10,"U","Pacific/Port_Moresby","airport","OurAirports"
6,"Wewak International Airport","Wewak","Papua New Guinea","WWK","AYWK",-3.58383011818,143.669006348,19,10,"U","Pacif
We can't make this file beautiful and searchable because it's too large.
airline,airlineid,sourceairport,sourceairportid,destairport,destairportid,codeshare,stop,equipment
2B,410,AER,2965,KZN,2990,,0,CR2
2B,410,ASF,2966,KZN,2990,,0,CR2
2B,410,ASF,2966,MRV,2962,,0,CR2
2B,410,CEK,2968,KZN,2990,,0,CR2
2B,410,CEK,2968,OVB,4078,,0,CR2
2B,410,DME,4029,KZN,2990,,0,CR2
2B,410,DME,4029,NBC,6969,,0,CR2
2B,410,DME,4029,TGK,\N,,0,CR2
2B,410,DME,4029,UUA,6160,,0,CR2
[
"ATL",
"PEK",
"DXB",
"LAX",
"HND",
"ORD",
"LHR",
"HKG",
"PVG",
[Desktop Entry]
Exec=bash -c "PID=$(lsof -ti:5901) && [ ! -z $PID ] && kill -9 $PID; ssh -fN -p 2930 -L 5901:localhost:5901 pwang2@65.52.0.118 && /usr/bin/xtigervncviewer -SecurityTypes None :1"
Name=wx
GenericName=Wechat on VNC
Icon=terminal
Terminal=false
Type=Application
Categories=Utilities;Application;
set -xe
PID="$(lsof -ti:5901 | paste -sd' ' | awk '{print $0}')"
if [ ! -z "$PID" ]; then
echo "$PID"
kill -9 $PID
fi
ssh -fN -p 2930 -L 5901:localhost:5901 pwang2@65.52.0.118
/usr/bin/xtigervncviewer -SecurityTypes None :1
@pwang2
pwang2 / preexec-display
Last active May 13, 2020 16:02
preexec to sync DISPLAY env
function preexec {
if [ -n "$TMUX" ]; then
export DISPLAY=$(tmux show-environment | grep -oP "(?<=SSH_CLIENT=)[\d\.]*"):0.0
else
export DISPLAY=$(env | grep -oP "(?<=SSH_CLIENT=)[\d\.]*"):0.0
fi
}
@pwang2
pwang2 / .Rprofile
Last active May 13, 2020 16:04
.Rprofile
library(colorout)
library(lintr)
library(styler)
grDevices::X11.options(width = 9.5, height = 8, ypos = 1000, xpos = 2800, pointsize = 10)
sysname <- Sys.info()[["sysname"]]
if (interactive() && sysname == "Linux" && Sys.getenv("DISPLAY") == "") {
if (Sys.getenv("TMUX") != "") {