Skip to content

Instantly share code, notes, and snippets.

View shudipta's full-sized avatar

Shudipta Sharma shudipta

View GitHub Profile
@shudipta
shudipta / kubectl_chitsheat
Last active June 18, 2020 16:24
`kubectl` hacks
# create k8s resource without reading from file
$ cat - <<-EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
name: dummy-secret
type: Opaque
data:
API_KEY: bWVnYV9zZWNyZXRfa2V5
API_SECRET: cmVhbGx5X3NlY3JldF92YWx1ZTE=
@shudipta
shudipta / get-latest-tag-on-git.sh
Created May 10, 2021 10:09 — forked from rponte/get-latest-tag-on-git.sh
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@shudipta
shudipta / postgres_queries_and_commands.sql
Created September 19, 2021 18:45 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'