Skip to content

Instantly share code, notes, and snippets.

:shipit:
What's happening?

Allan Lei allanlei

:shipit:
What's happening?
Block or report user

Report or block allanlei

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@allanlei
allanlei / Dockerfile
Last active Jul 24, 2017
xfsprogs builder
View Dockerfile
FROM debian
ARG VERSION=v4.12.0
RUN apt-get update
RUN apt-get install -y \
git-core \
libtool \
build-essential \
gettext \
View daemonset.yaml
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
name: startup-script
namespace: kube-system
labels:
app: startup-script
spec:
template:
metadata:
@allanlei
allanlei / Dockerfile
Last active Jan 7, 2019
Running cron in Docker via compiled image
View Dockerfile
FROM alpine
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# run: docker run -it --rm IMAGE "* * * * * echo hello"
@allanlei
allanlei / mounted-volume.sh
Last active Jan 7, 2019
Running cron in Docker via mounted volume
View mounted-volume.sh
docker run -it --rm -v tasks.cron:/tasks.cron alpine:3.5 sh -c "crontab /tasks.cron && crond -f -L /dev/stdout"
@allanlei
allanlei / singleline.sh
Last active Jan 7, 2019
Running cron in Docker via command
View singleline.sh
docker run -it --rm alpine sh -c "echo \"* * * * * echo hello\" | crontab - && crond -f -L /dev/stdout"
@allanlei
allanlei / utils.py
Created Jun 24, 2016
Configuration helpers for flask-cache
View utils.py
from six.moves import urllib
def config(uri):
parsed = urllib.parse.urlparse(uri)
options = dict(urllib.parse.parse_qsl(parsed.query))
cache_type = parsed.scheme.lower()
if cache_type not in ['null', 'simple', 'file', 'memcached', 'saslmemcached', 'redis']:
raise Exception('Misconfiguration')
View mqtt.js
// "use strict";
// var minimatch = require('minimatch');
// var replaceall = require('replaceall');
//
//
// function Authorizer(acl) {
// this.acl = acl || [];
// }
// module.exports = Authorizer;
//
@allanlei
allanlei / elb-acm-ssl.config
Last active Mar 14, 2016
Configures AWS Elastic Beanstalk with ACM SSL. Add to .ebextensions/
View elb-acm-ssl.config
option_settings:
- namespace: aws:elb:listener:443
option_name: ListenerProtocol
value: HTTPS
- namespace: aws:elb:listener:443
option_name: SSLCertificateId
value: YOUR-ARN-HERE
- namespace: aws:elb:listener:443
option_name: InstancePort
value: 80
@allanlei
allanlei / elb-acm-ssl.config
Created Mar 14, 2016
Configures AWS Elastic Beanstalk with ACM SSL.
View elb-acm-ssl.config
option_settings:
- namespace: aws:elb:listener:443
option_name: ListenerProtocol
value: HTTPS
- namespace: aws:elb:listener:443
option_name: SSLCertificateId
value: YOUR-ARN-HERE
- namespace: aws:elb:listener:443
option_name: InstancePort
value: 80
View publish.py
import paho.mqtt.client as mqtt
client = mqtt.Client(protocol=mqtt.MQTTv311)
client.connect('iot.eclipse.org', port=1883, keepalive=60)
client.publish('update', 'hello world')
You can’t perform that action at this time.