Skip to content

Instantly share code, notes, and snippets.

View mehar's full-sized avatar
💭
Hiring software craftsmen

Mehar mehar

💭
Hiring software craftsmen
  • hudku
  • Bangalore
View GitHub Profile
@mehar
mehar / k8s_podentrypoint_bash_while_loop.md
Created October 23, 2020 21:50
k8s_podentrypoint_bash_while_loop.md
apiVersion: v1
kind: Pod
metadata:
  name: ubuntu
spec:
  containers:
  - name: ubuntu
    image: ubuntu:latest
 # Just spin & wait forever
Discover k8s resources
```
kubectl api-resources
```
Fetch resource schemas
```
kubectl explain replicaset --recursive
```
@mehar
mehar / tcpdump.md
Created November 29, 2018 09:56
TCP Dump CheatSheet

Dump http parsed messages

tcpdump -A -vv 'port 8086'
@mehar
mehar / Shell_Scripting_CheatSheet.md
Created October 20, 2018 15:04
Shell Scripting Cheat Sheet
FOO=${VARIABLE:-default}  # If variable not set or null, use default.
FOO=${VARIABLE:=default}  # If variable not set or null, set it to default.
sed 's/,/,\n/g' bigdata2.txt > bigdata2_formatted.txt
cat bigdata2_formatted.txt | grep label | awk -F ":" '{print $2}' | sort | uniq -c
@mehar
mehar / git_and_github_cheatsheet.md
Last active June 2, 2018 07:15
Git/GitHub CheatSheet

Useful Default Configurations

# git push by default pushes all matching branches upstream, options simple will just push the current branch
git config --global push.default simple
# git pull by default do a fetch and merge, introduces a merge commit, instead use a 'git pull --rebase' as default
git config --global pull.rebase true
# Configure ReReRe (Reuse Recorded Resolution)
git config --global rerere.enabled true
@mehar
mehar / BashCommandCheatSheet.sh
Last active May 13, 2018 13:56
Bash Command CheatSheet
# Single Quote ('') vs Double Quote("")
Enclosing characters in single quotes (‘'’) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.
[https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html#Double-Quotes]
# Sort directories by size and print
du -h --max-depth=1 | sort -hr
# Setup ssh key based access
ssh-copy-id user@host
@mehar
mehar / JavaNotes.md
Last active March 22, 2018 11:52
Java Notes

Print JVM defaults

java -XX:+PrintFlagsFinal

Print System Properties

jcmd process_id VM.system_properties

Print JVM tuning flags

@mehar
mehar / flinkSummary.js
Created January 16, 2018 14:11
Flink Summary Script
/**
Instructions:
1) Open flink console
2) Open javascript console in the browser
3) Paste this script
4) When required call flinkSummary()
**/
// Import axios javascript
if (!document.getElementById("axios_script_id")) {
# Set the base index for windows to 1 instead of 0
set -g base-index 1
# Set the base index for panesl to 1 instead of 0
setw -g pane-base-index 1
# Reload tmx configuration
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf!"
# Ensure we can send Ctrl+b to other apps