Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View nickbailey's full-sized avatar

Nick Bailey nickbailey

View GitHub Profile
# Convert a number from Roman notation to Arabic.
# Nick Bailey, nickbailey at github.com. 25th July 2023.
# From https://gist.github.com/pysysops/7596f1c0a5c6d14151bbd987a2fb95e5
# Syntax check from the python roman package: https://pypi.org/project/roman/
#
function roman () {
roman_numerals=$(echo $1 | tr a-z A-Z)
# Test that it is valid
[[ "${roman_numerals//[IVXLCDM]/}" == "" ]] || {
@nickbailey
nickbailey / push_to_jack.cpp
Last active June 13, 2019 09:47
An adapter to allow old-school data-push audio apps to work as JACK clients
// A little bit of research to find out how to regress jack to ALSA :)
// compile with g++ push_to_jack.cpp -ljack
#include <jack/jack.h>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <iostream>
@nickbailey
nickbailey / gdl.tex
Created December 6, 2018 13:58
Geometrically Divided Line in tikz
\documentclass{minimal}
\usepackage{tikz,ifthen}
\usetikzlibrary{calc}
% HELPER MACROS
% Proportional postion of the first tick
%
% Arguments: number of segments, ratio
@nickbailey
nickbailey / thread_pool-test.cpp
Last active October 24, 2018 08:32
ThreadPool: Use all your cores
/*
* Test the thread_pool class
*
* Compile with g++ -I.. ../thread_pool.cpp thread_pool-test.cpp -pthread
*/
#include <iostream>
#include <mutex>
#include <exception>
#include "thread_pool.h"