Skip to content

Instantly share code, notes, and snippets.

View jujhars13's full-sized avatar

Jujhar Singh jujhars13

View GitHub Profile
@jujhars13
jujhars13 / sftp.yaml
Last active March 7, 2024 00:16
kubernetes pod example for atmoz/sftp
apiVersion: v1
kind: Namespace
metadata:
name: sftp
---
kind: Service
apiVersion: v1
metadata:
@jujhars13
jujhars13 / proxy.nginx.conf
Last active June 6, 2023 04:43
nginx-mysql-proxy
#sudo wget http://nginx.org/download/nginx-1.9.12.tar.gz
#sudo tar -xvzf nginx-1.9.12.tar.gz
#cd nginx-1.9.12
#sudo apt-get install -y build-essential libpcre3 libpcre3-dev zlib1g-dev
#sudo ./configure --with-stream && sudo make && sudo make install
# /usr/local/nginx/conf/nginx.conf - NGINX configuration file
worker_processes 1;
@jujhars13
jujhars13 / wonky-insert-script.sh
Created November 21, 2022 11:08
insert into sqlite demo
#!/bin/bash
echo "SELECT * FROM people" | sqlite3 person.sqlite
echo "INSERT INTO people (firstName,lastName)
VALUES
('john', 'marsden-"{$RANDOM_ID}"')
" | sqlite3 person.sqlite
echo "SELECT * FROM people" | sqlite3 person.sqlite
MY_NAME=nitish
@jujhars13
jujhars13 / delete-ns.sh
Last active July 25, 2022 13:42
deleting kubernetes namespaces that are stuck in "Terminating..."
#!/bin/bash
# Thanks to https://medium.com/@craignewtondev/how-to-fix-kubernetes-namespace-deleting-stuck-in-terminating-state-5ed75792647e
# NB this can be dangerous, so use sparingly
export ns=broken-app; kubectl get ns "${ns}" -o json | sed s/\"kubernetes\"//g | kubectl replace --raw /api/v1/namespaces/"${ns}"/finalize -f -
@jujhars13
jujhars13 / vimNotes.sh
Created April 19, 2021 09:52
vimNotes using vim to save my notes on a weekly basis (bound to super+N)
#!/bin/bash
# inspired by Leafshade software https://www.youtube.com/watch?v=zB_3FIGRWRU&t=333s
# daily notes
#noteFilename="$HOME/Dropbox/notes/notes/note-$(date +%Y-%m-%d).md"
# weekly notes
fileDate="$(date +%Y-%m-%d)"
if [[ "$(date +%a)" != "Mon" ]]; then
fileDate="$(date -dlast-monday +%Y-%m-%d)"
fi
@jujhars13
jujhars13 / index.js
Last active December 2, 2020 12:25
Kubernetes 101 course - basic no-deps web server in Node
/**
* Plain Rest Web api, no external deps
* Nodejs > 14
*/
const http = require("http");
const {
port = 8080,
yourName = "Themba",
environment = "development",
} = process.env;
@jujhars13
jujhars13 / gurmukhiTransliterator.bas
Created April 13, 2016 07:20
Ancient Gurmukhi to English transliterator written in EvB
'original version by Tarsem Singh of STTM
Attribute VB_Name = "Module1"
Private Function convertedChar(AscID) As String
'Debug.Print Chr(AscID) & "=" & AscID
Select Case AscID
Case 32: convertedChar = " "
Case 48: convertedChar = "0"
Case 49: convertedChar = "1"
Case 50: convertedChar = "2"
@jujhars13
jujhars13 / .zshrc
Last active June 4, 2020 10:10
Create a log entry for my daily work log, a bit like workingon.co used to work. Commits changes to git
# log what I'm working on to a text file unde `$repo/<year>/<month>/<day>.md`
# change the $repo variable to point to a dir on your machine
# if the dir is a git repo then it will also commit to git, otherwise just do nothing
#
# USAGE: on "working on creating a script to make things better"
function on(){
local version="1.1.4"
local repo="/home/jujhar/proj/jujhar-daily-log"
local year=$(date +%Y)
local month=$(date +%m)
@jujhars13
jujhars13 / watch.bat
Created November 27, 2012 11:28
watch.bat - watch command for windows - drop this file on your path
rem Watch.bat - trying to emulate linux watch command on windows
rem inspired by http://stackoverflow.com/questions/6765554/is-there-a-windows-command-line-equivalent-to-linux-watch-command amd http://superuser.com/questions/191063/what-is-the-windows-analog-of-the-linux-watch-command
@echo off
title Watch %1 %2 %3 %4 %5
:loop
cls
%1 %2 %3 %4 %5
echo.
timeout /t 2
goto loop