Skip to content

Instantly share code, notes, and snippets.

Laxman Singh Laxman-SM

  • intertrust technologies india
  • US, Hyderabad (india)
Block or report user

Report or block Laxman-SM

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
View gist:7624a5793a874f1751ddad3c3dfede7f
#!/bin/bash -xe
# Parse to get Zookeeper hosts
ZK_HOST=$(grep 'zookeeper.connect=' /etc/kafka/ | cut -d'=' -f 2)
# Find the newest version of Kafka in the /opt directory
KAFKA_PATH=$(find /opt/ -maxdepth 1 -name kafka-2* | sort | tail -n1)
# Manually configured list of brokers to rebalance across (zero-indexed)
Laxman-SM /
Created Jan 23, 2018 — forked from jay-johnson/
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using and

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
Laxman-SM /
Created Dec 19, 2017 — forked from bvis/
Autoregister your swarm nodes in Portainer
# Create the password needed to login to portainer and reuse it for the portainer endpoints.
export VOLUME_DRIVER=local
export PORTAINER_ENC_PASS=$(docker run --rm httpd:2.4-alpine htpasswd -nbB admin ${PORTAINER_PASS} | cut -d ":" -f 2)
echo $PORTAINER_PASS | docker secret create portainer_password.v1 --label portainer -
# Deploy the stack!
docker stack deploy --compose-file docker-compose.yml portainer
Laxman-SM /
Created Dec 19, 2017 — forked from bvis/
Docker Env Vars expanded with secrets content

Variables by Secrets

Sample script that allows you to define as environment variables the name of the docker secret that contains the secret value. It will be in charge of analyze all the environment variables searching for the placeholder to substitute the variable value by the secret.


You can define the next environment variables:


CloudFormation -> Terraform Import Helpers

I wrote these scripts to help faciliate batch import of our CloudFormation templates into Terraform Configuration.

This script is a light wrapper around It simply iterates over the list of regions provided, exports expected variables, creates required directories, and calls

BASE_DIR=/path/to/dir EXCLUDE_REGEX="(some-stack-production|some-stack-staging)" ./ us-east-1 us-west-1
Laxman-SM /
Created Nov 11, 2017 — forked from mgoodness/
Bash script for draining & terminating EC2 Kubernetes nodes
#!/usr/bin/env bash
k8s_node=$(echo $1 | cut -f2 -d '/')
kubectl drain --force --ignore-daemonsets --delete-local-data ${k8s_node}
if [[ $? -eq 0 ]]; then
kubectl delete node ${k8s_node}
Laxman-SM /
Created Oct 30, 2017 — forked from lwolf/
Script to convert docker-compose compatible environment files into kubernetes secrets
requires click package:
- pip install click
Example usage:
- python --src=production-ru.env --dst=production-ru-secret.yaml --fmt=yaml --name=my-app-secret
import base64
import click
View Cloudformation.json
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Cloud Formation Template for S3 based static site",
"Mappings": {
"RegionMap": {
"us-east-1": {
"S3hostedzoneID": "Z3AQBSTGFYJSTF",
"websiteendpoint": ""
"us-west-1": {
Laxman-SM /
Created Sep 18, 2017 — forked from sourcec0de/
Install docker compose on coreos
sudo su -
mkdir -p /opt/bin
curl -L`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
You can’t perform that action at this time.