Skip to content

Instantly share code, notes, and snippets.

arthurtsang / nginx config
Created Sep 25, 2019
nginx config for git server
View nginx config
# Default server configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html/git;
# Add index.php to the list if you are using PHP
arthurtsang /
Last active Sep 25, 2019 to start nginx and fcgiwrap
#!/usr/bin/env bash
set -exuo pipefail
export PATH=$PATH:/bfx/bin/nextflow/19.07.0
spawn-fcgi -u www-data -s /var/run/fcgiwrap.socket /usr/sbin/fcgiwrap
nginx -g "daemon on;"
nextflow "$@"
arthurtsang / Dockerfile
Last active Sep 25, 2019
Dockerfile for Git Server
View Dockerfile
FROM nextflow:19.07.0
# copy nextflow pipeline to /bfx/nextflow
ADD . /bfx/nextflow
# install git (and configure it), nginx, fcgiwrap and apache2-utils
RUN apt-get update && \
apt-get install -y git && \
git config --global "" && \
git config --global "company admin" && \
arthurtsang / gmail-auth.utils.ts
Created Aug 30, 2019
authorize and get token from gmail api using protractor
View gmail-auth.utils.ts
import gmailCred from '../resources/gmail.credentials.json';
import { gmail_v1, google } from 'googleapis';
import * as fs from 'fs';
import { OAuth2Client } from 'google-auth-library';
import { browser, by, ElementFinder } from 'protractor';
// If modifying these scopes, delete token.json.
const SCOPES = [''];
// The file token.json stores the user's access and refresh tokens, and is
// created automatically when the authorization flow completes for the first
arthurtsang / app.po.ts
Last active Aug 30, 2019
Simple utility class for protractor
View app.po.ts
import { browser, ElementFinder, ExpectedConditions, ProtractorBrowser, by } from 'protractor';
export const defaultTimeout = 10000;
export class AppPo {
browserWindow: ProtractorBrowser;
constructor(browserWindow: ProtractorBrowser = browser) {
this.browserWindow = browserWindow;
arthurtsang / gmail-html.utils.ts
Last active Aug 30, 2019
Extracting HTML from GMail
View gmail-html.utils.ts
* search for email with gmailSearchQuery (e.g. "to: subject: spam")
* and get the raw content of the mail
async searchEmail(gmailSearchQuery: string): Promise<any[]> {
const auth = await this.authorize();
const gmail ={ version: 'v1', auth });
return new Promise((resolve, reject) => {
arthurtsang /
Created Feb 14, 2017 — forked from Newmu/
Prototype code of conv/deconv variational autoencoder, probably not runable, lots of inter-dependencies with local codebase =/
import theano
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from theano.tensor.signal.downsample import max_pool_2d
from theano.tensor.extra_ops import repeat
from theano.sandbox.cuda.dnn import dnn_conv
from time import time
import numpy as np
from matplotlib import pyplot as plt
arthurtsang /
Created Jan 31, 2017 — forked from staltz/
The introduction to Reactive Programming you've been missing
View gist:9470ffac0d0f9a674984
import lombok.Data;
public class IdolConfig {
String host;
int indexPort;
int searchPort;
arthurtsang / gist:403ebbacee3cf5497187
Created Feb 9, 2015
Ratpack 0.9.13 HandlerFactory
View gist:403ebbacee3cf5497187
public class HandlerFactory implements ratpack.launch.HandlerFactory{
private final static Logger logger = LoggerFactory.getLogger(HandlerFactory.class);
private ConfigData configData;
public HandlerFactory(ConfigData configData) {
this.configData = configData;
@SuppressWarnings({ "unchecked", "rawtypes" })