Skip to content

Instantly share code, notes, and snippets.

View cheungpat's full-sized avatar

Kwok-kuen Cheung cheungpat

View GitHub Profile
@cheungpat
cheungpat / gist:11098136
Created April 19, 2014 21:33
Pass mount options to yas3fs
#!/usr/bin/python¬
¬
import argparse¬
import subprocess¬
¬
if __name__ == '__main__':¬
parser = argparse.ArgumentParser()¬
parser.add_argument('-o', dest='options')¬
parser.add_argument('s3path')¬
parser.add_argument('localpath')¬
@cheungpat
cheungpat / gist:1b6222a6a62bb3b42a99
Created October 9, 2014 01:51
Embed certs in OpenVPN config
#!/usr/bin/python
import argparse
import sys
def should_embed(line):
return True in (line.startswith(k) for k in ['ca', 'key', 'cert', 'dh'])
def embed(filename, out):
for line in (l.strip() for l in open(filename, 'r').readlines()):
@cheungpat
cheungpat / Dockerfile
Created November 27, 2014 10:41
rq-scheduler Dockerfile
FROM python:3
MAINTAINER cheungpat <me@cheungpat.com>
RUN pip install rq-scheduler==0.5.0
ENTRYPOINT rqscheduler

Keybase proof

I hereby claim:

  • I am cheungpat on github.
  • I am cheungpat (https://keybase.io/cheungpat) on keybase.
  • I have a public key whose fingerprint is B5BD 21ED DFBB 4835 75FE BC1E 617D 7093 12CD A17C

To claim this, I am signing this object:

@cheungpat
cheungpat / Dockerfile
Last active February 13, 2016 15:05
fluentd-s3
FROM fluent/fluentd:latest
MAINTAINER Kwok-kuen Cheung <me@cheungpat.com>
RUN gem install fluent-plugin-s3
@cheungpat
cheungpat / get-kube-local.sh
Last active April 21, 2016 08:02
Run Kubernetes locally with Docker and bind apiserver to 0.0.0.0
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@cheungpat
cheungpat / Dockerfile
Created May 7, 2016 03:23
Dockerfile-node-6.1
FROM node:6.1
ENV TINI_VERSION v0.9.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
@cheungpat
cheungpat / 0_reuse_code.js
Created May 15, 2016 14:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@cheungpat
cheungpat / docker-compose.yml
Created July 31, 2016 00:07
Docker Compose for roundcube with imapproxy
version: '2'
services:
imapproxy:
image: cheungpat/imapproxy
environment:
SERVER_HOSTNAME: imap.gmail.com
roundcube:
image: robbertkl/roundcube
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" anywhere on a line. The complete list of parameter names and allowed