Skip to content

Instantly share code, notes, and snippets.

View sumitdhameja's full-sized avatar
🎯
Focusing

Sumeet Dhameja sumitdhameja

🎯
Focusing
View GitHub Profile
@sumitdhameja
sumitdhameja / manifest-template.yaml
Created February 27, 2016 18:13 — forked from jbeda/manifest-template.yaml
Script to create VM to host private docker registry on GCE backed by GCS
# Copyright 2014 Google Inc. 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@sumitdhameja
sumitdhameja / start-local-registry.sh
Created February 27, 2016 18:16 — forked from smreed/start-local-registry.sh
Shell script that starts up a local docker registry with a Google Cloud Storage backend using local credentials.
#!/bin/bash
LOCAL_REGISTRY_NAME=local-docker-registry
GCS_BUCKET=some-bucket
CONFIG_DIR=$HOME/.config
LOCAL_REGISTRY_ID=`docker ps -q $LOCAL_REGISTRY_NAME`
if [ ! -z "$LOCAL_REGISTRY_ID" ]; then
#! /bin/bash
# Copyright 2014 Google Inc. 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
#
@sumitdhameja
sumitdhameja / kafka-part-distrib.sh
Created February 27, 2016 18:25 — forked from kashyapp/kafka-part-distrib.sh
matrix that shows partition distribution for a topic across brokers
#!/bin/bash -e
/usr/share/fk-3p-kafka/bin/kafka-topics.sh $ZOOKEEPER --describe --topic $1 \
| grep Leader \
| awk '{print $4,$8}' | sed 's/,/ /' \
| awk '{
for(i=1;i<7;++i){a[i]=0};
sum[$2]++; sum[$3]++;
a[$2]=1; a[$3]=1;
printf "%3d ",$1;
for (i=1;i<7;++i) {printf "%3d ",a[i]}; printf "\n";
@sumitdhameja
sumitdhameja / gce-centos-6.3-install-light.sh
Created February 27, 2016 18:29 — forked from andypotanin/gce-centos-6.3-install-light.sh
Setup CentOs 6.3 on Google Compute Engine with Node.js, Git, SVN and other commons.
# Set variables in .bash_profile for convenience:
# GOOGLE_COMPUTE_PROJECT_NAME - e.g. "my-project"
#
# Run locally:
# sudo ssh-add ~/.ssh/google_compute_engine
# gcutil ssh $GOOGLE_COMPUTE_INSTANCE_NAME
# Cache project name
gcutil getproject --project=$GOOGLE_COMPUTE_PROJECT_NAME --cache_flag_values
#!/bin/bash
#
# UPTIME MONITOR
# --------------
# Usage: Setup a cronjob to execute the script and your done.
#
# Copyright (c) 2012, T. Zengerink
# Licensed under MIT License.
# See: https://raw.github.com/gist/3151357/9e8e01df4ee12b1f04cd61e0ecee3ea8bd6f617b/mit-license.txt
@sumitdhameja
sumitdhameja / netmon.sh
Created February 27, 2016 18:43 — forked from kokanee/netmon.sh
network monitoring shell script
#!/bin/bash
COUNT=10
while :
do
if [ $COUNT = 10 ]
then
printf "+--------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ \n"
printf "| TIME |ESTAB|LISTN|T_WAT|CLOSD|S_SEN|S_REC|C_WAT|F_WT1|F_WT2|CLOSI|L_ACK| \n"
printf "+--------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ \n"
COUNT=0
@sumitdhameja
sumitdhameja / bash_profile.sh
Created March 7, 2016 01:36 — forked from mrcrilly/bash_profile.sh
A simple Bash function to wrap the `gcloud compute instances create` sub-command, making it easier to work with.
# Possibly add this to ~/.bash_profile
# Ensure you have the Google Cloud SDK installed
function gce-create() {
GCE_BIN=$(which gcloud)
GCE_SCOPES=default="https://www.googleapis.com/auth/cloud.useraccounts.readonly","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring.write"
GCE_IMAGE="https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-7-v20160219"
GCE_POLICY=MIGRATE
GCE_ZONE=us-central1-a
GCE_TYPE=f1-micro
@sumitdhameja
sumitdhameja / replace-cluster.sh
Created March 7, 2016 01:44 — forked from azr/replace-cluster.sh
Quickly replace a Google Cloud Kubernetes Cluster by a new one ( with new machine type, scopes and/or number of nodes ), keeping the credentials
#!/bin/bash
CLUSTER=""
PROJECT_CMD=""
ZONE_CMD=""
SCOPES=""
NUM_NODES="1"
MACHINE_TYPE=""
DISK_SIZE="100GB"