Skip to content

Instantly share code, notes, and snippets.

@ejber-ozkan
ejber-ozkan / mongo-atlas-api.bash
Last active February 18, 2019 11:22
A few bash functions for MongoDB Atlas API querying.
# A bunch of simple functions to expand and use to query the MongoDB Atlas API.
export TOKEN="[create your mongodb atlas api token and enter it here]"
export GROUPID="[enter groupid or project id]"
export API="https://cloud.mongodb.com/api/atlas/v1.0"
export USERNAME="[enter user]"
# groupid = projectid
# https://cloud.mongodb.com/v2/$GROUPID#clusters
# ideally python and jq is required.
@ejber-ozkan
ejber-ozkan / get-current-k8s-quotas.bash
Last active September 12, 2018 08:50
Kubernetes get current quotas in namespaces to CSV
#!/bin/bash
echo "get-current-k8s-quotas.bash "
echo "... Outputs daily quotas hard limits and actual usage"
echo "... Requires kubectl, jq and access to k8s clusters and kubectl already"
echo "..."
export DATE=`date '+%Y-%m-%d-%H'`
for i in namespace1 namespace2 namespace3 namespace4
do
@ejber-ozkan
ejber-ozkan / postgres_queries_and_commands.sql
Created July 27, 2016 12:10 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), 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(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'