Skip to content

Instantly share code, notes, and snippets.

View bugcy013's full-sized avatar
🪄
Focusing

Dhanasekaran Anbalagan bugcy013

🪄
Focusing
View GitHub Profile
#!/usr/bin/env bash
# Begin Standard 'imports'
set -e
set -o pipefail
gray="\\e[37m"
blue="\\e[36m"
red="\\e[31m"
yellow="\\e[33m"
@bugcy013
bugcy013 / init-functions.sh
Created April 21, 2022 12:16
/lib/lsb/init-functions
# /lib/lsb/init-functions for Debian -*- shell-script -*-
#
#Copyright (c) 2002-08 Chris Lawrence
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions
#are met:
#1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@bugcy013
bugcy013 / brew-without-sudo.md
Created April 18, 2022 16:37
MacOS Homebrew without sudo

Homebrew is a popular framework for quickly installing development tools on MacOS, including Gfortran. MacOS cloud services such as MacInCloud may say they provide Homebrew, but you may not be able to install packages without a sudo/admin account. To install Homebrew without sudo/admin in the user home directory for cloud or physical Mac hardware, follow these steps:

mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

Edit ~/.profile to include

export PATH=$HOME/homebrew/bin:$PATH
@bugcy013
bugcy013 / Authentication Types.md
Created March 15, 2022 15:05
Authentication Types

Basic Authentication

1 basic

JWT - JSON Web Tokens

2 jwt

OAuth - Open Authorization

3 oauth

Auth Strategies - Session Based Authentication

4 session_based

Single Sign-On - SSO

5 sso

@bugcy013
bugcy013 / Ansible-module-sample-bash.sh
Created March 7, 2022 05:56 — forked from devops-school/Ansible-module-sample-bash.sh
Ansible Module Sample Code using Linux Bash script Example 5
#touch.bash
#!/bin/bash
# import variables from ansible
source $1
state=${state:-present}
if [[ $state == "present" ]]; then
if [ ! -e $file ]; then
touch $file
echo { \"changed\": true }

Supported built-in functions

  • abs(float) - Returns the absolute value of a given float. Example: abs(1) returns 1, and abs(-1) would also return 1, whereas abs(-3.14) would return 3.14. See also the signum function.

  • basename(path) - Returns the last element of a path.

  • base64decode(string) - Given a base64-encoded string, decodes it and returns the original string.

@bugcy013
bugcy013 / tf_functions.tf
Created March 6, 2022 15:04 — forked from carlessanagustin/functions.tf
Terraform functions by example
##--------------------------
## Terraform: Functions ##
##--------------------------
## Open terraform console
terraform console
#######################
## Numeric Functions ##
#######################
import requests
import logging
import pandas as pd
level = "INFO"
logging.basicConfig(level=level, format="%(levelname)-10s| %(asctime)-10s | %(funcName)-10s | %(message)s")
def get_request():
all_items = []
#!/bin/sh
# Launch a Pod ab-using a privileged=true to land on a Kubernetes node cluster as root,
# uses `privileged: true` to then nsenter init mount its (root) namespace,
# hostPID and hostNetwork already set for the Pod.
node=${1}
case "${node}" in
"")
nodeSelector=''
podName=${USER+${USER}-}sudo-any
;;