Skip to content

Instantly share code, notes, and snippets.

View ctrlcctrlv's full-sized avatar
🛠️
happy hacking

Fredrick Brennan ctrlcctrlv

🛠️
happy hacking
View GitHub Profile
@ctrlcctrlv
ctrlcctrlv / nib_stroker.rs
Created March 24, 2021 02:49
Nib stroker from FontForge (WIP 2)
#![feature(fn_traits)]
use fontforge_sys as fontforge;
use glifparser;
use std::fs;
use std::os::raw;
use std::ops::Fn;
use std::ptr;
#[derive(Default, Debug, PartialEq)]
@ctrlcctrlv
ctrlcctrlv / fontinfo.json
Last active March 31, 2021 17:13
Computer Modern instances
{
"fonts": [
{
"instance": {
"filename": "cmmi6.mf",
"name": "Computer Modern Math Italic 6 point",
"id": "CMMI",
"size": "6pt#",
"type": "mathit"
},
static LANGUAGE_ISO: &[Option<&[&str]>] = &[
Some(&["abq"]),
Some(&["abk"]),
Some(&["ach"]),
Some(&["acr"]),
Some(&["ady"]),
Some(&["afr"]),
Some(&["aar"]),
Some(&["ahg"]),
Some(&["aio"]),
@ctrlcctrlv
ctrlcctrlv / search_example.c
Created April 26, 2021 11:22
Example of using functions in search.h
// gcc -g -O0 -lm -o /tmp/search_example /tmp/search_example.c
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <search.h>
int main(int argc, char* argv[]) {
// Create a hash table with 255 entries.
#!/bin/bash
FN=lines2 # input file
OUTP=`(mecab -Oyomi | nkf -h1 -w | awk '{ORS="\n"; print $s "\t" NR;}' | sort) < "$FN"`;
OUTI=$(echo "$OUTP" | awk -F "\t" '{ if (ff != substr($s, 1, 1)) { ff=substr($s, 1, 1); print ff };'\
'{ system("sed "$NF"q\\;d '"$FN"'") }}');
OUTF=$(egrep -v '^[A-Za-z]+' <<< "$OUTI" && egrep '^[A-Za-z]+' <<< "$OUTI"); echo "$OUTF"
@ctrlcctrlv
ctrlcctrlv / clap_issue_1820.rs
Created October 25, 2021 14:15
Solution to clap issue #1820 (having an argument that is both a flag and positional)
use clap::{self, App, AppSettings, Arg};
fn main() {
let matches = App::new("glif2svg")
.setting(AppSettings::ArgRequiredElseHelp)
.version("0.1.0")
.author("Fredrick R. Brennan <copypasteⒶkittens⊙ph>; MFEK Authors")
.about("Convert between glif to SVG")
.arg(Arg::with_name("input_file")
.short("in")
@ctrlcctrlv
ctrlcctrlv / gen_hwd.sh
Created January 27, 2022 10:00
Generate Hellworld Dispatch episode
#!/bin/bash
# Generate Hellworld Dispatch episode
EP=$1
# Height of the video frames we tell ffmpeg to generate. We cut off bottom half to make mountains.
WAVESHEIGHT=512
# lol if u don't have an NVIDIA card remove prime-run and the nvidia wankery
NVIDIA_ARGS='-vsync 0 -hwaccel cuda -hwaccel_output_format cuda'
NVIDIA_RUNNER=prime-run
@ctrlcctrlv
ctrlcctrlv / inkscape_guidelines_b0rkd.diff
Created February 1, 2022 09:13
Inkscape issues №356, №615, №1180 fixed—I think.
diff --git a/src/file-update.cpp b/src/file-update.cpp
index c363f19..962a6e7 100644
--- a/src/file-update.cpp
+++ b/src/file-update.cpp
@@ -306,19 +306,36 @@ bool sp_file_save_backup( Glib::ustring uri ) {
return return_value;
}
+// See if we need to offer the user a fix for the 90->96 px per inch change.
+// std::cout << "SPFileOpen:" << std::endl;
@ctrlcctrlv
ctrlcctrlv / jeopardy_fursona.sh
Last active March 26, 2022 14:55
ffmpeg jeopardy thinking music generator
#!/bin/bash
function ffstreamlength ()
{
ffprobe -print_format json -show_streams "$1" 2> /dev/null |\
jq '.streams[]|select(.codec_type=="audio")|.tags.DURATION' -r |\
awk 'BEGIN { FS=":" } {printf "%.0f\n", ($1*60*60)+($2*60)+$3}'
}
COL=010b79
@ctrlcctrlv
ctrlcctrlv / mariam.xml
Created April 9, 2022 04:01
Mariam Soulakiotis Polly SSML
<?xml version="1.0"?>
<speak>
<p>Abbess Mariam <phoneme alphabet="ipa" ph="suːlɒkiːoʊtiː">Soulakiotis</phoneme> (born c. 1883, died 23 November 1954;), born with the name Marina <phoneme alphabet="ipa" ph="suːlɒkiːoʊ'toʊː">Soulakiotou</phoneme>, known both to her followers as Mariam of <phoneme alphabet="ipa" ph="kɛrə'teɪ'ə">Keratea</phoneme>, and in contemporary media pejoratively as "Mother <phoneme alphabet="ipa" ph="ræˈspu'tiːn">Rasputin</phoneme>", was a Greek Old Calendarist Eastern Orthodox abbess who was found guilty of numerous counts of serial murder, fraud and other crimes, which public prosecutors of the Kingdom of Greece alleged she committed against both laypeople and other nuns in her abbey between 1939 and her arrest in December 1950.</p>
<p>During the time period of the crimes she was convicted of, <phoneme alphabet="ipa" ph="suːlɒkiːoʊtiː">Soulakiotis</phoneme> was neither a member of the mainstream Greek Orthodox Church nor in communion with the other, larger Old Calendarist group, the "Flo