Skip to content

Instantly share code, notes, and snippets.

package main
import "fmt"
func main() {
myEmail := &Email{}
myEmail.withFrom("sender").
withTo("recipient").
withSubject("hello").
withBody("howdy?")
package main
import "fmt"
func main() {
var sendEmail emailAction = func(payload string) {
fmt.Printf("sending email: %v\n", payload)
}
action := sendEmail.
@namp10010
namp10010 / k8s-short-resource-names.md
Created May 9, 2021 23:28
k8s short resource names

kubectl api-resources

Short name Full name
csr certificatesigningrequests
cs componentstatuses
cm configmaps
ds daemonsets
deploy deployments
ep endpoints
@namp10010
namp10010 / randNumber.go
Created June 22, 2021 23:35
golang cryto/rand random number example
package main
// https://play.golang.org/p/3DeMCc248KQ
import (
"crypto/rand"
"encoding/binary"
"fmt"
)
func main() {
@namp10010
namp10010 / checkpoint.sh
Created September 24, 2021 01:44 — forked from bubenkoff/checkpoint.sh
Endpoint Security VPN FULL start/stop script for Mac OS X
#!/bin/bash
#
# The reason of creating this script is that Endpoint Security VPN installs it's own application firewall kext cpfw.kext
# which prevents for example PPTP connections from this computer, which is not appropriate if you need subj connection just
# from time to time
#
# Usage: ./checkpoint.sh
#
# The script checks if Enpoint Security VPN is running. If it is, then it shuts it down, if it is not, it fires it up.
# Or, make an Automator action and paste the script.
@namp10010
namp10010 / privileges.sh
Created September 29, 2021 07:35
SAP PrivilegesCLI
#!/bin/zsh
# the PrivilegesCLI (verson 1.5.2) is located under
# /Applications/Privileges.app/Contents/Resources/PrivilegesCLI
# running it without any arguments would show the following hint
# Usage: PrivilegesCLI <arg>
#
# Arguments: --add Adds the current user to the admin group
# --remove Removes the current user from the admin group
# --status Displays the current user's privileges
@namp10010
namp10010 / privileges.sh
Created December 12, 2021 07:20
SAP macOS Enterprise Privileges command line CLI
#!/bin/zsh
# To make the command line version of Privileges more accessible so that it can be run as part of a script
# For Privileges v1.5.2 (1195)
ln -s /Applications/Privileges.app/Contents/Resources/PrivilegesCLI /usr/local/bin/admin
# Usage
# admin --add
# admin --remove
@namp10010
namp10010 / bash_test_operators.md
Last active December 19, 2021 21:36
Bash test operators copied from Kapeli page as I will always have to google it

Bash test operators

A gist copied from kapeli page

Integer Comparison

Integer Comparison
-eq is equal toif [ "$a" -eq "$b" ]
-ne is not equal toif [ "$a" -ne "$b" ]
@namp10010
namp10010 / loop-over-json.sh
Last active February 21, 2022 23:38
Bash for Loop Over JSON Array Using jq
#!/bin/bash
# https://www.starkandwayne.com/blog/bash-for-loop-over-json-array-using-jq/
# how to run
# chmod u+x loop-over-json.sh
# ./loop-over-json.sh
sample='[{"name":"foo"},{"name":"bar"}]'
for row in $(echo "${sample}" | jq -r '.[] | @base64'); do
_jq() {
@namp10010
namp10010 / wurstmeister_kafka.md
Created March 27, 2022 04:01
wurstmeister kafka docker compose command

Create simple docker compose setup

version: "3"
services:
  zookeeper:
    image: 'wurstmeister/zookeeper:latest'
    ports:
      - '2181:2181'