Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
What's happening?

Allan Lei allanlei

:shipit:
What's happening?
View GitHub Profile
@allanlei
allanlei / daemonset.yaml
Last active Sep 2, 2019
Kubernetes sysctl daemonset for tuning Transparent Huge Pages
View daemonset.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: kube-system
name: sysctl
spec:
selector:
matchLabels:
app: sysctl
template:
@allanlei
allanlei / deployment.yaml
Created Jan 28, 2018
Install kubectl into a Kubernetes Pod
View deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: redis
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
@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
You can’t perform that action at this time.