Skip to content

Instantly share code, notes, and snippets.

View igb's full-sized avatar
Probably drinking coffee.

Ian Brown igb

Probably drinking coffee.
View GitHub Profile
@igb
igb / wa11y140.sh
Created February 12, 2022 16:49
Shell script for trimming accessible Wordle descriptions down to 140 characters or less when possible.
IFS=""
if [ "$#" -ne 1 ]; then
wordle=`pbpaste`;
else
wordle=`cat $1`
fi
filters=(
"s/Line //;"
touch README
mkdir -p src/java
mkdir -p testsrc/java
mkdir -p lib/java
mkdir -p libext/java
touch project.properties
echo "src.dir=src/java" >> project.properties
echo "testsrc.dir=testsrc/java" >> project.properties
echo "lib.dir=lib/java" >> project.properties
#INSTALL GMP
cd /tmp/
curl -O https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz
tar -xzvf gmp-6.2.1.tar.xz
cd gmp-6.2.1
./configure --prefix=/usr/local
make clean
make
sudo make install
cd /tmp/
@igb
igb / slice.sh
Created October 14, 2021 19:28
Wrapper around slic3r to make easier and more reliable prints with a Creality Ender Pro v3
#!/bin/bash -e
FILENAME="${1%%.*}"
if [ $2 ]
then
DUPLICATES="--duplicate $2"
-module(levenshtein).
-export([levenshtein_distance/2]).
levenshtein_distance(Source, Target) ->
Score=lists:append([[X || X <- lists:seq(0, length(Target))]], [lists:append([Y],[n || X <- lists:seq(1, length(Source) - 1)]) || Y <- lists:seq(1, length(Source))]),
NewScore=levenshtein_distance_source(Source, Target, Score, 1, 1),
%io:fwrite("~p~n", [NewScore]),
get_score(length(Source), length(Target), NewScore).
@igb
igb / index.html
Last active October 15, 2015 21:20
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>Streamgraph</title>
<head>
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: auto;
@igb
igb / 5monkeys.rb
Created September 24, 2015 17:18
Five Little Monkeys Jumping on the Bed
m="monkey"
l="little "
f="Five #{l}#{m}s"
s="So "<<f.downcase
t=[]
t<<"It was bedtime."
t<<"#{s} took a bath."
t<<"#{f} put on their pajamas."
t<<"#{f} brushed their teeth."
@igb
igb / gist:29c5cd4d33c7a3e7b94a
Created July 5, 2015 22:37
Five Little Monkeys Jumping on the Bed
m="monkey"
l="little "
f="Five #{l}#{m}s"
s="So "<<f.downcase
t=[]
t<<"It was bedtime."
t<<"#{s} took a bath."
t<<"#{f} put on their pajamas."
t<<"#{f} brushed their teeth."