Skip to content

Instantly share code, notes, and snippets.

Mohan Balasundaram tuxfight3r

Block or report user

Report or block tuxfight3r

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
tuxfight3r /
Last active Apr 27, 2019
container basics cgroups namespaces
# Prepare a hash. We need it to identify our container.
$ uuid="ps_$(shuf -i 42002-42254 -n 1)"
# Prepare a root dir for all the containers.
$ btrfs_path='/var/bocker' && cgroups='cpu,cpuacct,memory';
# Prepare root filesystem based on the given `$image`.
$ btrfs subvolume snapshot "$btrfs_path/$image" "$btrfs_path/$uuid" > /dev/null
# Create a cgroup
tuxfight3r /
Last active Apr 25, 2019
Python script for returning environment facts in json format based on the requested network.
# Author: Mohan Balasundaram
# Date: 25/04/2019
# Purpose: python api for node location facts in json format
from flask import Flask, request, Response
import netaddr
import json
# user data

My Openshift Cheatsheet

Examine the cluster quota defined for the environment:

$ oc describe AppliedClusterResourceQuota

Install pkgs using yum in a Dockerfile

tuxfight3r /
Last active Apr 27, 2019
minikube tips & tricks

create a new minikube profile

minikube profile lab

minikube set config for cpu/memory/disk

minikube config set cpus 4
minikube config set memory 8192
minikube config set disk-size 10240MB
tuxfight3r /
Created Apr 18, 2019 — forked from drmalex07/
Tunnel TCP traffic via socat. #socat
listen_address=$(ip -f inet addr show dev ${LISTEN_IFACE} | grep -Po 'inet \K[\d.]+')
tuxfight3r /
Created Apr 18, 2019 — forked from drmalex07/
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot


Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/

tuxfight3r / lambda-basic-auth.js
Created Apr 16, 2019 — forked from lmakarov/lambda-basic-auth.js
Basic HTTP Authentication for CloudFront with Lambda@Edge
View lambda-basic-auth.js
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
tuxfight3r /
Last active Apr 19, 2019
EKS Tips & Tricks

Get logged in user name

aws sts get-caller-identity

EKS updated Kubeconfig

aws eks update-kubeconfig --name eksdemocluster

Get login token for dashboard from authenticator

tuxfight3r /
Created Apr 14, 2019 — forked from mtulio/
Basic EKS lab to setup an new cluster
# Basic EKS client Setup and management
# Doc:
OS_DIST=$(cat /etc/os-release |grep ^NAME |awk -F'=' '{print$2}')
tuxfight3r /
Created Feb 21, 2019 — forked from so0k/
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
You can’t perform that action at this time.