Skip to content

Instantly share code, notes, and snippets.

View codemedic's full-sized avatar
🙂
🙃

Dino Korah codemedic

🙂
🙃
View GitHub Profile
@codemedic
codemedic / clion64.vmoptions
Created July 26, 2017 18:10
CLion JVM options
-server
-Xms1G
-Xmx3072m
-Xss2m
-XX:MaxMetaspaceSize=1536m
-XX:ReservedCodeCacheSize=240m
-XX:MetaspaceSize=512m
-XX:+DoEscapeAnalysis
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:+UnlockExperimentalVMOptions
@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 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 / RESTdoc
Last active June 9, 2020 08:24 — forked from coderofsalvation/RESTdoc
bash utility to generate REST-documentation from sourcecode comments
#!/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 / 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 / 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 / # 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 / 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 / .bashrc
Last active October 3, 2021 11:26 — forked from chetanmeh/.bashrc
Script to launch commands in multiple tabs in KDE Konsole
[ -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 / upload.sh
Created January 16, 2018 10:33
Uploading files to S3 via bash with minimum deps (curl, openssl, base64)
#!/bin/bash
file="$1"
region="eu-west-1"
key_id="YOUR-AWS-KEY-ID"
key_secret="YOUR-AWS-KEY-SECRET"
path="some-directory/$file"
bucket="s3-bucket-name"
content_type="application/octet-stream"
date="$(LC_ALL=C date -u +"%a, %d %b %Y %X %z")"