Skip to content

Instantly share code, notes, and snippets.

View MonadicT's full-sized avatar

Praki Prakash MonadicT

  • San Francisco Bay Area
View GitHub Profile
BRIDGE_IF= "enp4s0f1" #Host interface to use for bridge interface creation in guest
MASTER_IP_NW= "192.168.1.0/24" # Subnet for Vagrant boxes
MASTER_IP="192.168.1.10" # IP address of Master
NFS_IP= "192.168.1.8" # IP address of NFS server |
WORKER_IP= "192.168.1.#{i + 10}" # "Worker IP pattern (generates 192.168.1.11, 192.168.1.12...) "
WORKER_COUNT=3 #Number of workers
@MonadicT
MonadicT / *scratch*.el
Created December 3, 2018 19:50
Snake case in Python using a PDA
def snake_case(s):
in_upper = False
out = []
stack = []
for c in s:
if c.isupper():
stack.append(c.lower())
else:
if len(stack) == 1:
if len(out) > 0: out.append('_')
@MonadicT
MonadicT / notes.org
Created October 12, 2018 19:23
k8s-get-root-ca

export secret=$(kubectl get serviceaccount $ACCT_NAME -o json|jq -r .secrets[].name) kubectl get secrets $secret -o json | jq -Mr ‘.data[“ca.crt”]’ | base64 -D

@MonadicT
MonadicT / notes.org
Last active October 12, 2018 18:28
k8s-get-sa-token

export secret=$(kubectl get serviceaccount $ACCT_NAME -o json|jq -r .secrets[].name) kubectl get secret $secret -o yaml|grep token:|awk ‘{print $2}’|base64 -D

@MonadicT
MonadicT / auth.js
Created July 31, 2018 19:06
elm-auth-handle-auth
function handleAuthentication() {
webAuth.parseHash(function(err, authResult) {
if (authResult && authResult.accessToken && authResult.idToken) {
window.location.hash = '';
let decodedId = jwtDecode(authResult.idToken);
let profile = { accessToken: authResult.accessToken,
email: decodedId.email,
emailVerified: decodedId.email_verified,
exp: decodedId.exp,
name: decodedId.name,
@MonadicT
MonadicT / Auth.elm
Created July 31, 2018 19:05
elm-auth0-sub-map
mapResult : PortAuthResponse -> Msgs.Msg
mapResult result =
case ( result.err, result.ok, result.stale ) of
( Just msg, _, _ ) ->
Msgs.Unauthenticated msg
( Nothing, _, True ) ->
Msgs.StaleAuth
( Nothing, Just user, False ) ->
@MonadicT
MonadicT / Main.elm
Created July 31, 2018 19:03
elm-auth0-sub
subscriptions : Model -> Sub Msg
subscriptions model =
Ports.authResponse Auth.mapResult
@MonadicT
MonadicT / Main.elm
Created July 31, 2018 19:02
elm-auth0-initial-model
initialModel : ( Model, Cmd Msg )
initialModel =
( { authenticated = False
, profile = Nothing
, errorMsg = ""
}
, Ports.authStatus ()
)
@MonadicT
MonadicT / Main.elm
Created July 31, 2018 19:00
elm-auth0-update
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
Unauthenticated err ->
( { model | authenticated = False }, Cmd.none )
StaleAuth ->
( model, Ports.authRequest () )
Authenticated profile ->
@MonadicT
MonadicT / postgres.txt
Created June 24, 2018 00:01
pg - Basic Postgres Commands
Basic Postgres commmands
- Install postgres
brew install postgres
# postgres and another user will be created in this step.
- Login as current user
psql
- Login as postgres user