Skip to content

Instantly share code, notes, and snippets.

@adithyakhamithkar
adithyakhamithkar / foo.log
Created November 26, 2018 08:57 — forked from ibeex/foo.log
Flask logging example
A warning occurred (42 apples)
An error occurred
@adithyakhamithkar
adithyakhamithkar / kafka-cheat-sheet.md
Created October 8, 2018 09:59 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@adithyakhamithkar
adithyakhamithkar / GitHub curl.sh
Created February 1, 2018 14:54 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@adithyakhamithkar
adithyakhamithkar / Instructions.md
Created January 3, 2018 11:05 — forked from pgilad/Instructions.md
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example

@adithyakhamithkar
adithyakhamithkar / commit-msg
Created January 3, 2018 11:05 — forked from opyate/commit-msg
JIRA code commit msg hook; presumes merges happen on remote (via PR mechanism, etc)
#!/bin/sh
# .git/hooks/commit-msg
test "" != "$(egrep '[A-Z]{3,}-\d+' "$1")" || {
echo >&2 Commit message requires JIRA code.
exit 1
}