Skip to content

Instantly share code, notes, and snippets.

View ammarnajjar's full-sized avatar

Ammar Najjar ammarnajjar

View GitHub Profile
@ammarnajjar
ammarnajjar / git-cheat-sheet.sh
Last active October 30, 2024 10:05
My git cheat sheet
# set user name
git config --global user.name "Ammar Najjar"
# set user email
git config --local user.email <email>
# set user sign key -S
git config --local user.signingkey <key>
# current branch name
@ammarnajjar
ammarnajjar / yml-envs.sh
Created October 12, 2022 08:00
parse yml to envs and source it in the running shell
# requires python3
# replace <path>
source <(python <<EOF
with open('<path>', 'r') as fi:
content = fi.readlines()
trans = [line.strip().replace(': ', '=').replace('\'', '"') for line in content if line.strip() and line.strip()[0] != '#']
envs = '\n'.join([f'export {line}' for line in trans])
print(envs)
EOF
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dNOPAUSE -dQUIET -dBATCH -dPrinted=false -sOutputFile=foo-compressed.pdf foo.pdf
@ammarnajjar
ammarnajjar / plugins.yaml
Last active June 20, 2025 15:45
k9s plugin to pretty print json logs using jq
# $XDG_CONFIG_HOME/k9s/plugins.yaml
plugins:
jqlogs:
shortCut: Ctrl-J
confirm: false
description: "Logs (jq)"
scopes:
- pod
command: sh
background: false