Skip to content

Instantly share code, notes, and snippets.

View tundeaoni's full-sized avatar

Olatunde Alex-Oni tundeaoni

View GitHub Profile
@tundeaoni
tundeaoni / index.html
Created November 30, 2016 08:55 — forked from anonymous/index.html
Capture FB Reactions count and show them on webpage
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My FB Reactions Page</title>
<style>
html {
box-sizing: border-box;
width: 100%;
@tundeaoni
tundeaoni / do_until.sh
Last active February 17, 2017 11:03
tiny bash script to retry task until it returns exit code 0
# !/bin/bash
readonly TIME_OUT=1
STATUS=1
printf "Command: %s \n" $@
#pass command
while [ "$STATUS" -ne 0 ]
do
"$@"
STATUS=$?
@tundeaoni
tundeaoni / replace_env_handlebar.sh
Last active April 21, 2017 15:27
Replace handlebars with env values
# !/bin/bash
if [[ -z "$1" ]]
then
echo "docker file needs to be specified";
fi
perl -p -e 's/\%([^%]+)\%/defined $ENV{$1} ? $ENV{$1} : "\${$1}"/eg' $1 > test
cat test
@tundeaoni
tundeaoni / get_rds_slow_queries
Last active October 24, 2019 13:26
get_rds_slow_queries.sh
#!/usr/bin/env python3
# run download rds log and extract slow queries
# usage example:
# ./get_rds_slow_queries.py --region eu-central-1 --rds-instance rds-instance-name --since 24
import boto3
import sys
import argparse
import datetime
import time
@tundeaoni
tundeaoni / accessed-grafana-logs
Created November 4, 2019 10:04
List accessed grafana dashboards from access logs
<cat access logs> | grep 'referer="' | awk '{print $15}' | sed -e 's|referer="<replace-with-grafana-url>/grafana/d/\(.*\)/\(.*\)?\(.*\)|\2|g' | sort | uniq | grep -v 'referer="'
@tundeaoni
tundeaoni / startup.sh
Created August 5, 2021 10:39
Sets command args using environment variables with prefix
#! /bin/sh
set -e
# Script extract env vairables by prefix
# and passes as command arguments
cmd=${1}
shift
if [ "$cmd" = "" ]
then