Skip to content

Instantly share code, notes, and snippets.

@lamak-qaizar
lamak-qaizar / gitlog.sh
Last active January 6, 2022 03:02
List commits between commit hashes
git log <from commit>..<to commit> --oneline
# commits with a custom output format
# e.g. |hash|author|date|commit message
git log <from commit>..<to commit> --pretty=format:"|%h|%an|%cD|%s"
# commits within a subdirectory or module
git log <from commit>..<to commit> --oneline ./subdirectory
# git docs: https://git-scm.com/docs/git-log
@lamak-qaizar
lamak-qaizar / redis-slowlog-pretty-printer.py
Last active November 27, 2020 07:47
Redis SLOWLOG pretty printer with formatted timestamps
# 1. Requirements:
# python3.6, redis-py
# 2. Run instructions:
# python redis-slowlog-pretty-printer.py <redis endpoint> <port> <# logs to get>
# eg. python redis-slowlog-pretty-printer.py localhost 6379 10
# 3. Sample output:
# <local date/time> [ <execution time> ]: <command>
# 2017-06-22 00:00:00 [ 10.0 s ]: b'keys *rk54jhk345hnmmlk4lk*'
@lamak-qaizar
lamak-qaizar / ab-command.sh
Last active May 13, 2023 03:42
ApacheBench 2.3 - Post request with headers
# 100 requests with 10 concurrent threads
# Headers: h1 and h2
# Query parameters: p1 and p2
# body.txt is the content of the body (supply blank file if no body)
ab -n 100 -c 10 -p ./body.txt -H "h1:value1" -H "h2:value2" -v 2 'http://url?p1=x&p2=y'