Skip to content

Instantly share code, notes, and snippets.

View ronalddddd's full-sized avatar
👋
Hi

Ronald Ng ronalddddd

👋
Hi
View GitHub Profile
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@ronalddddd
ronalddddd / build.sh
Created May 9, 2017 09:41
Docker build and push script
#!/bin/bash
set -e
REGISTRY=registry.gitlab.com
REGISTRY_GROUP=${REGISTRY_GROUP:=acme}
REGISTRY_USERNAME=${REGISTRY_USERNAME:=${REGISTRY_GROUP}-ci}
PROJECT_NAME="${PWD##*/}"
IMAGE_TAG=${IMAGE_TAGE:=latest}
IMAGE_NAME=${REGISTRY}/${REGISTRY_GROUP}/${PROJECT_NAME}:${IMAGE_TAG}
echo "BUILD TARGET: ${REGISTRY_USERNAME}@${IMAGE_NAME}"
@ronalddddd
ronalddddd / Logger.js
Created January 11, 2017 10:00
Reusable logger (with cloudwatch transport and request logging middleware)
// Generic logger with CloudWatch transport
const winston = require('winston');
const WinstonCloudWatch = require('winston-cloudwatch');
const AWS_REGION = process.env.npm_config_logger_cloudwatch_log_region;
const AWS_KEY_ID = process.env.npm_config_logger_cloudwatch_key_id;
const AWS_SECRET = process.env.npm_config_logger_cloudwatch_key_secret;
const LOG_GROUP_NAME = process.env.npm_config_logger_cloudwatch_log_group || 'unknown-group';
const LOG_STREAM_NAME = process.env.npm_config_logger_cloudwatch_log_stream || 'unknown-stream';
const LOG_LEVEL = process.env.npm_config_logger_log_level || 'info';
@ronalddddd
ronalddddd / .gitlab-ci.yml
Last active February 21, 2018 20:28
Template .gitlab-ci.yml for automating docker image build, test, release
image: docker:1.11.2-git
stages:
- build
- test
- release
#- deploy
variables:
CONTAINER_IMAGE_NAME: myImage
CONTAINER_REGISTRY_NAMESPACE: myNamespace
@ronalddddd
ronalddddd / setup-rancher.sh
Last active July 20, 2018 13:58
Launch a Rancher server with https access
#!/bin/bash
# - You need to set RANCHER_DOMAIN to a domain that reaches this host via port 80 and 443
# - Run this script with sudo/root,
# e.g. `source setup-rancher.sh`
# - You can then access the Rancher dashboard via https://rancher.example.com
# - To add docker hosts to your Rancher environments,
# follow the rest of http://docs.rancher.com/rancher/latest/en/quick-start-guide/
# Configure these
RANCHER_DOMAIN="rancher.example.com"
@ronalddddd
ronalddddd / var-v-let.js
Created January 17, 2016 09:39
ES6 function vs block scope example
for (var i=0; i<5; i++){
setTimeout(() => console.log('function-scoped i:', i), 100);
}
for (let i=0; i<5; i++){
setTimeout(() => console.log('block-scoped i:', i), 100);
}
@ronalddddd
ronalddddd / whatsmyip.sh
Created June 5, 2015 03:05
Get my public IP from bash
curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
@ronalddddd
ronalddddd / 0_reuse_code.js
Last active August 29, 2015 14:22
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
@ronalddddd
ronalddddd / masonry-ordered.pkgd.js
Created May 6, 2015 03:05
Masonry Ordered Grid Hack (packaged with dependencies)
/*!
* Masonry PACKAGED v3.3.0
* Cascading grid layout library
* http://masonry.desandro.com
* MIT License
* by David DeSandro
*/
/**
* Bridget makes jQuery widgets