Skip to content

Instantly share code, notes, and snippets.

View codemedic's full-sized avatar
🙂
🙃

Dino Korah codemedic

🙂
🙃
View GitHub Profile
@codemedic
codemedic / gpg.md
Last active August 31, 2022 12:15 — forked from landro/gpg.md
Configure ssh-agent emulation in gpg-agent

Install gnupg

brew install gnupg
brew install pinentry-mac

Make sure you have gpg 2.1.20 or better

gpg --version
gpg (GnuPG) 2.1.20
@codemedic
codemedic / README.md
Last active April 5, 2022 01:39
Add SSH URL Handler for macOS
@codemedic
codemedic / # mpv - 2021-01-19_13-00-56.txt
Created January 19, 2021 13:11
mpv on Ubuntu 16.04.7 LTS - Homebrew build logs
Homebrew build logs for mpv on Ubuntu 16.04.7 LTS
Build date: 2021-01-19 13:00:56
@codemedic
codemedic / natophon.sh
Created November 16, 2020 14:53 — forked from bradland/natophon.sh
NATO phonetic string converter for bash
#!/bin/bash
#########################################################################
# #
# #
# NATO String converter #
# #
# Description: converts string (first parameter given) #
# to NATO phonetics-alphabet #
# #
@codemedic
codemedic / bubbles.cpp
Last active September 28, 2020 19:07
Blow bubbles with C++
void
blow_bubbles_till(bool& condition)
{
static const char* sprite = ". o O @ *";
unsigned frame = 0;
while (!condition) {
boost::this_thread::sleep_for(boost::chrono::milliseconds(250));
std::cerr << "\r‗‗" << std::string(sprite + frame * 5, 5) << ' ';
frame = (frame + 1) % 5;
}
@codemedic
codemedic / README.md
Last active January 15, 2020 23:23
GPG Key Backup

Run pdflatex --shell-escape gpgbackup.tex to produce a pdf that you can print and lock away.

In order to recover the key, you will have to scan extract individual QR Codes with names IMGa.png, IMGb.png, IMGc.png and IMGd.png, as given in the name of each figure, then run the recovery commands.

NOTE: The above command WILL leave some artefacts in /tmp which should be removed using the command rm /tmp/IMG*png

PS: Original formula for this gist was from @costrouc.

@codemedic
codemedic / gpg2qrcodes.sh
Created January 15, 2020 14:27 — forked from joostrijneveld/gpg2qrcodes.sh
Producing printable QR codes for persistent storage of GPG private keys
# Heavily depends on:
# libqrencode (fukuchi.org/works/qrencode/)
# paperkey (jabberwocky.com/software/paperkey/)
# zbar (zbar.sourceforge.net)
# Producing the QR codes:
# Split over 4 codes to ensure the data per image is not too large.
gpg --export-secret-key KEYIDGOESHERE | paperkey --output-type raw | base64 > temp
split temp -n 4 IMG
for f in IMG*; do cat $f | qrencode -o $f.png; done
@codemedic
codemedic / README.md
Last active March 29, 2023 12:34
Linux-like terminal in Mac OS

Linux-like terminal in Mac OS

Caveat: This was done as a quick-fix to aleviate my pain; There could be a better way to do this. Please do leave comments and suggestions.

This script is meant to be used as .bashrc, in order to make the transition from Linux to MacOS less painful. It makes available GNU tools and utils in your PATH so that they can be invoked effortlessly. It also allows you to leave an untainted terminal setup for anything very native to MacOS.

@codemedic
codemedic / bash-colors.sh
Created April 3, 2019 09:03
Utility function to print bash colour codes
# based on https://github.com/mathieu-aubin/c7repos/blob/master/functions/bash-colors
__print_color_row() {
local color
color=$(printf '%03d' "$1")
echo -ne "\\033[1;48;5;${color}m \\\\033[48;5;${color}m \\033[0m";
echo -ne "\\033[1;7;38;5;${color}m\\\\033[7;38;5;${color}m \\033[0m";
echo -ne " \\033[1;38;5;${color}m\\\\033[1;38;5;${color}m\\033[0m";
echo -ne " \\033[38;5;${color}m\\\\033[38;5;${color}m\\033[0m";
echo -ne " \\033[2;38;5;${color}m\\\\033[2;38;5;${color}m\\033[0m";
@codemedic
codemedic / kinesis-get-records.sh
Last active May 29, 2023 15:40
Get records from a AWS Kinesis Data Stream. It allows you to start iterating from a time in the past.
#!/usr/bin/env bash
if ! aws_bin="$(which aws)" 2>/dev/null; then
echo "aws cli is missing; you can get it from https://aws.amazon.com/cli/"
exit 1
fi
if ! jq_bin="$(which jq)" 2>/dev/null; then
echo "jq is missing; you can get it from https://stedolan.github.io/jq/"
exit 1