Skip to content

Instantly share code, notes, and snippets.

View chainhead's full-sized avatar
💭
Machine, learning ...

mrchainhead chainhead

💭
Machine, learning ...
  • Bengaluru, INDIA
  • 08:23 (UTC +05:30)
View GitHub Profile
@chainhead
chainhead / openshift-nodes.md
Last active October 7, 2019 16:18
OpenShift notes

Introduction

This file documents the steps I followed to create and deploy an application to an OpenShift cluster. These instructions have been gathered after much trials and tribulations on maxcOS Mojave - YMMV.

Installation - minishift

Since this is an educational exercise, I used minishift - an OpenShift cluster that is just enough to get started. To work with minishift, a CLI tool oc is also installed.

Pre-requisites

@chainhead
chainhead / cert-manager.md
Last active December 25, 2019 13:09
Using cert-manager
@chainhead
chainhead / 0-intro.md
Last active March 24, 2020 13:00
MQTT and Server Sent Events with NodeJs

Introduction

This gist describes an MQTT client writing sensor data to an Server Sent Events (SSE) end-point.

Getting started

git clone https://gist.github.com/chainhead/715e48a2f157e2bfe3f012f587f8bf5b
npm i express mqtt
node server.js
@chainhead
chainhead / 0-intro.md
Last active September 24, 2020 14:50
Getting git credentials from AWS Systems Manager

Introduction

This is a short description of how to get git credentials in an EC2 instance set-up for CI/CD scripts. In the following scripts, we do the following:

  • Install the AWS CLI. See here for description of steps on Linux.
  • Install jq to parse the JSON output from CLI.
  • Run the aws CLI for ssm (AWS Systems Manager) to extract parameter values for git user.
  • Set the git user name globally.
  • Set the name of the script in GIT_ASKPASS that will return the git password.
@chainhead
chainhead / 0-intro.md
Last active March 24, 2021 05:00
HTTP server handling connection upgrade

Introduction

This gist shows a basic implementation of a HTTP server that handles the request to upgrade connection to Websockets.

@chainhead
chainhead / 0-intro.md
Last active March 28, 2021 02:29
Logging in Go - logrus

Introduction

A basic implementation of logging with Go language. Copied from https://www.honeybadger.io/blog/golang-logging/

Usage

  1. Run the following commands to test with built-in log package. Logs will be saved in logs.txt.
go run log.go
@chainhead
chainhead / 0-intro.md
Last active August 19, 2021 03:56
mosquitto-k8s

Introduction

# https://raw.githubusercontent.com/eclipse/mosquitto/master/mosquitto.conf
kubectl create ns/mqtt
kubectl -n mqtt create configmap mosquitto-conf --from-file=mosquitto.conf
kubectl -n mqtt create -f deploy.yaml
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
#GPIO SETUP
channel = 21
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel, GPIO.IN)
def moisture_detect(channel):
@chainhead
chainhead / README.md
Created May 2, 2022 00:09
Sample Websockets client

Introduction

This is a sample Websocket client to send random JSON payload to a Websockets server.

Installation

After cloning this gist, run the following commands.

npm init -y
@chainhead
chainhead / 0-install.md
Last active September 12, 2022 08:40
Strimzi installation on Ubuntu-22.04

Install NodeJs

curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs -y

Install Docker