Skip to content

Instantly share code, notes, and snippets.

View hmdmph's full-sized avatar
🏠
Working from home

Manoj Prasanna Handapagnoda hmdmph

🏠
Working from home
  • Cipher Solutions Pvt Ltd
  • Sri Lanka
View GitHub Profile
# completion script for above awss function
# If you change your function name, replace your function name with here awss
# the grep I used here is quite important and may be not work with your profile without simple tweak
# Simple logic is you have to have a command that returns all of the profile in aws config
_awss_completion()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@hmdmph
hmdmph / aws_add_profile.sh
Last active January 23, 2022 08:34
Simple bash function to add AWS profile
#!/bin/bash
#
# DESCRIPTION:
# * simple aws function that help you to add aws profile by just passing arguments
#
# USAGE:
# 1. Save this function in your ~/.bashrc or ~/.bash_profile or ~/.profile
# 2. Edit the places where required
# 2.1 replace <REGION> with your default region. Well region can be parametrised if u wish :D.
# e.g. ap-southeast-1
@hmdmph
hmdmph / git_aws_k8s_bash_prompt.sh
Last active February 1, 2022 11:42 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to git/svn branch, and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to: (well there is k9s, but this is highly customizable as you wish; like I did :D)
# * current AWS profile configured (really helpful if you are switching AWS accounts frequently)
# * current context of Kubernetes(K8S) cluster ( also helpful to see which cluster you are working on
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
@hmdmph
hmdmph / go_port_forwarding.go
Created November 28, 2021 13:31 — forked from qhwa/go_port_forwarding.go
network port forwarding in go lang
package main
import (
"fmt"
"io"
"net"
)
func main() {
ln, err := net.Listen("tcp", ":8080")
@hmdmph
hmdmph / update-git-repos.sh
Last active September 6, 2017 05:40
Update all git repositories in a folder
#!/bin/bash
# update all git repositories in give folder
COLOR_NONE="\033[0m"
COLOR_1="\033[1;34m"
# making changes to shell options, affects regular expressions
shopt -s extglob nullglob
# check whether 1 arugment passed, if so then use it as base directory, else use current director as base directory