Skip to content

Instantly share code, notes, and snippets.

View mingzhou's full-sized avatar
🎯
Focusing

Mingzhou ZHUANG mingzhou

🎯
Focusing
View GitHub Profile
@mingzhou
mingzhou / OANDA-v20-nodejs-example.js
Created August 23, 2017 00:37 — forked from risacher/OANDA-v20-nodejs-example.js
example of how to invoke OANDA V20 API from node.js
"use strict";
const oandaV20 = require('@oanda/v20/context');
const fs = require('fs');
var ctx = new oandaV20.Context('api-fxpractice.oanda.com', 443, true, "demo");
var key = fs.readFileSync('api.key', {encoding: 'utf8'});
//remove any bad chars (e.g. the trailing newline)
key = key.replace(/[^0-9a-fA-F-]/g, "");
console.log(key);
@mingzhou
mingzhou / gist:56fd14c2707b7c839c1acff21964beed
Created November 6, 2017 11:53 — forked from cvogt/gist:9193220
Slick: Dynamic query conditions using the **MaybeFilter** (Updated to support nullable columns)
import scala.slick.lifted.CanBeQueryCondition
// optionally filter on a column with a supplied predicate
case class MaybeFilter[X, Y](val query: scala.slick.lifted.Query[X, Y]) {
def filter[T,R:CanBeQueryCondition](data: Option[T])(f: T => X => R) = {
data.map(v => MaybeFilter(query.filter(f(v)))).getOrElse(this)
}
}
// example use case
import java.sql.Date
@mingzhou
mingzhou / Docker connect to remote server.md
Created March 15, 2018 07:54 — forked from kekru/Docker connect to remote server.md
Connect to another host with your docker client, without modifying your local Docker installation

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.
For HTTPS connection use whiledo/docker-remote-api-tls.

@mingzhou
mingzhou / tmux-cheatsheet.markdown
Created July 22, 2018 23:43 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]