Skip to content

Instantly share code, notes, and snippets.

@namp10010
namp10010 / commit_count.md
Created July 13, 2022 23:42
Count git commits in a folder/directory
cd <dir>
git log . | grep -E "^commit\ [a-z0-9]{40}$" | wc -l

FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@namp10010
namp10010 / bash_strict_mode.md
Created June 6, 2022 00:12 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@namp10010
namp10010 / golang-tls.md
Created May 11, 2022 22:58 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@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'
@namp10010
namp10010 / kafka-console-consumer.md
Last active May 5, 2022 05:36
kafka-console-consumer.sh arguments list

kafka-console-consumer.sh

`docker exec -it /bin/bash

kafka-console-consumer.sh --help
This tool helps to read data from Kafka topics and outputs it to standard output.
Option                                   Description
------                                   -----------
--bootstrap-server 
@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 / 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 / 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