Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
😄

Dino Korah codemedic

😀
😄
View GitHub Profile
@codemedic
codemedic / konsole-with-palette-colours.css
Last active Jan 11, 2021
CSS for KDE Konsole minimal, lighter, dark tabs
View konsole-with-palette-colours.css
QTabBar,
QTabBar::tab
{
font-family: "Noto Sans";
font-size: 11px;
height: 16px;
padding: 2px;
border: 0px;
border-bottom: 3px solid palette(dark);
background-color: palette(dark);
@codemedic
codemedic / natophon.sh
Created Nov 16, 2020 — forked from bradland/natophon.sh
NATO phonetic string converter for bash
View natophon.sh
#!/bin/bash
#########################################################################
# #
# #
# NATO String converter #
# #
# Description: converts string (first parameter given) #
# to NATO phonetics-alphabet #
# #
@codemedic
codemedic / fix_docker_host_vpn_connectivity.sh
Last active Nov 11, 2020
Docker network through host IPSec / Strongswan VPN
View fix_docker_host_vpn_connectivity.sh
# Link up docker network via IPSec VPN on docker-host
#
# Usage: [dry_run=1] [debug=1] vpn-docker-fix [<a-docker-network>]
#
# Env Variables:
# dry_run - Set to 1 to have a dry run, just printing out the iptables command
# debug - Set to 1 to see bash substitutions
vpn-docker-fix() {
_log_stderr() {
echo "$*" >&2
@codemedic
codemedic / .bashrc
Last active Oct 24, 2020 — forked from chetanmeh/.bashrc
Script to launch commands in multiple tabs in KDE Konsole
View .bashrc
[ -r ~/path/to/konsole-tabs.sh ] &&
. ~/path/to/konsole-tabs.sh
# Run multiple commands in individual tabs
commands_in_tabs() {
local cmd profile clear_first clear_cmd="" exit_new_tabs_afterwards exit_current_tab_afterwards title i
local sessions=()
: "${profile:="$(qdbus org.kde.konsole /Konsole defaultProfile)"}"
: "${clear_first:=1}"
@codemedic
codemedic / bubbles.cpp
Last active Sep 28, 2020
Blow bubbles with C++
View bubbles.cpp
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 / RESTdoc
Last active Jun 9, 2020 — forked from coderofsalvation/RESTdoc
bash utility to generate REST-documentation from sourcecode comments
View RESTdoc
#!/bin/bash
#
# A quickndirty bash-utility to generate REST-documentation from sourcecode comments.
# (initially aimed at php-files, but js should also work)
# Basically its a c-style comment -> markdown -> html converter
# Dependancies:
# - awk
# - sed
# - bash
# - php
@codemedic
codemedic / bash-colors.sh
Created Apr 3, 2019
Utility function to print bash colour codes
View bash-colors.sh
# 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 Mar 23, 2020
Get records from a AWS Kinesis Data Stream. It allows you to start iterating from a time in the past.
View kinesis-get-records.sh
#!/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
@codemedic
codemedic / README.md
Last active Jan 15, 2020
GPG Key Backup
View README.md

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 Jan 15, 2020 — forked from joostrijneveld/gpg2qrcodes.sh
Producing printable QR codes for persistent storage of GPG private keys
View gpg2qrcodes.sh
# 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
You can’t perform that action at this time.