Skip to content

Instantly share code, notes, and snippets.

View countless-integers's full-sized avatar

Adrian countless-integers

View GitHub Profile
@countless-integers
countless-integers / mongo_collections_counts.js
Created January 4, 2017 12:41
Dummy collection count in mongodb
var collections = db.getCollectionNames();
collections.forEach(function (item) {
print(item + ": " + db[item].stats().count);
});
@countless-integers
countless-integers / kube-log.sh
Created January 6, 2017 12:23
tail logs from kubernetes pod
#!/bin/bash
podId=$(kubectl get pod -o name | \
grep --color=never -o -E \
"\/.*$(echo $@ | tr '_ ' '.').*" \
)
podId=$(echo $podId | sed 's/ .*//g' | tr -d '/')
echo Showing logs from $podId
kubectl logs $podId --tail=20 -f
@countless-integers
countless-integers / check-expiring-certificates-template.py
Created July 8, 2020 15:48
A quick and dirty script to help with checking page certificate expiry dates. It's in Python2 for compatibility reasons, so logic was redacted to serve as a template and not ready-made solution.
#!/usr/bin/env python2
from os import environ
import datetime
import socket
import ssl
import logging
from urllib2 import Request, urlopen, URLError, HTTPError
import json
@countless-integers
countless-integers / update-ide-helper-files
Created July 23, 2020 12:40
slow and round-about way of updating my ide-helper files
#!/bin/bash
COMPOSER_MEMORY_LIMIT=-1 composer require --dev barryvdh/laravel-ide-helper
php artisan ide-helper:generate
php artisan ide-helper:meta
COMPOSER_MEMORY_LIMIT=-1 composer remove barryvdh/laravel-ide-helper
@countless-integers
countless-integers / bash_arg_parser.sh
Last active July 28, 2022 15:08
Bash argument parser supporting long options and positional arguments alike
#!/bin/bash
# @source: https://medium.com/@Drew_Stokes/bash-argument-parsing-54f3b81a6a8f
PARAMS=""
while (( "$#" )); do
case "$1" in
-a|--my-boolean-flag)
MY_FLAG=0
shift