Skip to content

Instantly share code, notes, and snippets.

View jcarrano's full-sized avatar

Juan I Carrano jcarrano

  • Berlin, Germany
View GitHub Profile
@jcarrano
jcarrano / class_registry.cpp
Created July 14, 2022 14:15
C++ Class Registry
/* Create a registry of classes
* Original idea: https://stackoverflow.com/questions/34858341/c-compile-time-list-of-subclasses-of-a-class
* also see https://stackoverflow.com/questions/72884647/when-are-static-member-variables-optimized-away
* for info about the subtleties of static members.
*/
#include <functional>
#include <iostream>
#include <map>
#include <typeinfo>
@jcarrano
jcarrano / agilent5462x.sh
Created June 10, 2022 16:10
Agilent 5462x Oscilloscope Screen Capture via Serial
#!/bin/sh
# Get a screen capture from an Agilent 5462x series oscilloscope vis serial port
# The device must use 57600 baud and DTR flow control.
# The image is in TIFF format and is output to stdout
TTYDEV=${1:-/dev/ttyUSB0}
stty -F $TTYDEV 57600 raw -echo min 0 time 5
exec 123<>$TTYDEV
@jcarrano
jcarrano / Doxyfile
Last active December 3, 2018 16:27
Doxygen Duplicate Enums
# Doxyfile 1.8.14
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a double hash (##) is considered a comment and is placed in
# front of the TAG it is preceding.
#
# All text after a single hash (#) is considered a comment and will be ignored.
# The format is:
@jcarrano
jcarrano / trac
Created February 9, 2018 15:55
Trac setup for Ubuntu
#/etc/nginx/sites-available/trac
upstream trac {
server 127.0.0.1:3050;
server 127.0.0.1:3051;
server 127.0.0.1:3052;
server 127.0.0.1:3053;
}
server {
listen 80 default_server;
@jcarrano
jcarrano / generate_openvpn_config.sh
Last active April 24, 2019 08:19 — forked from dmytro/generate_openvpn_config.sh
Script for OpenVPN generate client config file.
#!/bin/bash
# Easy script to create OpenVPN client configuration with the user, pre-generating user's
# RSA key and certificate.
#
# Configuration template must exist in the same directory, with only missing part: certificates.
#
# (c) Dmytro Kovalov, 2015
# Modified by Juan Carrano, 2018
cd $(dirname ${BASH_SOURCE[0]})
@jcarrano
jcarrano / example_activity_graph.csv
Last active February 14, 2024 16:51
Program Evaluation and Review Technique (PERT) Montecarlo Simulator (Python and Haskell)
SPEC-1 7 -2 1
RES-1 14 -4 5
PROTO-1 RES-1 14 -4 10
SPEC-2 SPEC-1, PROTO-1 4 -1 2
DSN-1 SPEC-2 30 -10 15
ORD-1 SPEC-2, DSN-1 2 -1 3
PROD-1 DSN-1 30 -5 20
DSN-2 SPEC-1 7 -3 1
DSN-3 SPEC-1 3 -1 1
PROD-2 DSN-2 45 -10 15
@jcarrano
jcarrano / roman.c
Created June 19, 2017 05:25
Two programs to convert an integer to Roman Numerals (written somewhere in 2010)
#include <stdio.h>
#include <stdlib.h>
#define MAXROMAN 3999 /*MMMCMXCIX*/
#define DIEZ 2
#define CINCO 1
#define UNO 0
const char seq[4][3]={ {'M', '?' , '?' }, { 'C' , 'D', 'M'}, { 'X' , 'L', 'C'}, {'I', 'V', 'X'} };