Skip to content

Instantly share code, notes, and snippets.


KC KazChe

View GitHub Profile
View monthly-iteration-between-two-dates.js
const moment = require('moment');
var startDate = moment('2019-03-12');
var endDate = moment('2019-05-04');
var result = [];
var endOfMonth;
if (endDate.isBefore(startDate)) {
throw "End date must be greated than start date."
while (startDate.isBefore(endDate)) {
KazChe / weekly-iteration-between-two-dates.js
Created May 4, 2019
Given two dates generate weekly output dates
View weekly-iteration-between-two-dates.js
const moment = require('moment');
let startDate = moment('2019-03-12');
let endDate = moment('2019-05-04');
let result = [];
if (endDate.isBefore(startDate)) {
throw "End date must be greated than start date."
while (startDate.isBefore(endDate)) {
let endOfWeek = startDate.clone().endOf('week').format("YYYY-MM-DD")
KazChe /
Created Sep 4, 2018 — forked from PurpleBooth/
A template to make good

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.


KazChe / AWS S3 Bucket Policy
Created Sep 4, 2018
AWS S3 bucket policy allowing only certain IP addresses to GET from it.
View AWS S3 Bucket Policy
"Version": "2008-10-17",
"Id": "S3PolicyId1",
"Statement": [
"Sid": "IPAllow",
"Effect": "Allow",
"Principal": {
"AWS": "*"
KazChe / Kubeless Installation - GKE
Created Aug 29, 2018
Kubeless Installation - GKE
View Kubeless Installation - GKE
$ gcloud container clusters create --cluster-version=1.9.7-gke.6 my-cluster --num-nodes 3 --zone us-central1-a
Creating cluster my-cluster...done.
kubeconfig entry generated for my-cluster.
my-cluster us-central1-a 1.9.7-gke.6 n1-standard-1 1.9.7-gke.6 3 RUNNING
$ kubectl create clusterrolebinding kubeless-cluster-admin --clusterrole=cluster-admin --user=<your gcp user-id> "kubeless-cluster-admin" created
$ export RELEASE=$(curl -s | grep tag_name | cut -d '"' -f 4)
KazChe / .bash_profile
Created Mar 19, 2018 — forked from paulocheque/.bash_profile
.bash_profile example
View .bash_profile
# EDITOR=nano sudo visudo
# Change the following line: (:i to insert + esc to go back + :w to save + :q to quit)
# Defaults env_reset
# to:
# Defaults env_reset,timestamp_timeout=960 # in minutes
export PATH=$PATH:.
# export PATH=$PATH:/usr/bin
KazChe / git-pull-all
Created Feb 26, 2018 — forked from grimzy/git-pull-all
Git pull all remote branches
View git-pull-all
#!/usr/bin/env bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
View lambdaDynamoDbScan.js
var AWS = require('aws-sdk');
var dynamodb = new AWS.DynamoDB({ apiVersion: '2012-08-10' });
var docClient = new AWS.DynamoDB.DocumentClient()
var params = {
TableName: "mytable",
FilterExpression: "#schedule_type = :schedule_type_val",
ExpressionAttributeNames: {
"#schedule_type": "schedule_type",
// we can narrow the returned result - still does a full-scan
KazChe / shared_folder_centos_virtualbox.txt
Last active Mar 3, 2017 — forked from larsar/shared_folder_centos_virtualbox.txt
Mount shared folder on CentOS in VirtualBox
View shared_folder_centos_virtualbox.txt
# The VirtualBox documentation[1] for how to install guest additions
# for Linux on a virtual host is somewhat messy. So here is what
# I did to make it work.
# Install the packages required
yum update
yum install gcc kernel-devel make
View Setting up mosquitto (mqtt) and brew on mac os
(from : )
Installing Brew
The Mosquitto MQTT Server can be easily installed using Homebrew. If it’s not installed on your system already, then a quick visit to the homepage will give you all you need to get going. Homebrew is an OS X Package Manager for installing and updating non-Mac OS X utilities that are more commonly found in other variants of Linux. To install the basic package manager run the following command.
ruby -e "$(curl -fsSL"
Installing Mosquitto MQTT
You can’t perform that action at this time.