Skip to content

Instantly share code, notes, and snippets.

View J3698's full-sized avatar
๐Ÿ›
Inch Worm

Anti J3698

๐Ÿ›
Inch Worm
  • Working
  • Working
View GitHub Profile
#ifndef MV_AVG_H
#define MV_AVG_H
typedef struct {
double average;
size_t oldest_index;
double *samples;
size_t num_samples;
} movingAverage_t;
# use gcc as the compiler
CC=gcc
visualizer: simple_visualizer.c libapa102.a moving_average.c
$(CC) -I/usr/local/include -L/usr/local/lib -L./libapa102 -I./libapa102/lib -o visualizer simple_visualizer.c moving_average.c -lapa102 -lwiringPi -lpthread -ljack -lm
libapa102.a: ~/visualizer/libapa102/lib/build/apa102.o ~/visualizer/libapa102/lib/build/apa102_anim.o
ar rcs $@ $^
~/visualizer/libapa102/lib/build/apa102.o:
{
'' : ...,
'he': ...,
'th': {
occurances: ['e', 'i', 'u', ...],
e: 582,
i: 226,
u: 56,
...
total: 1692
function createChain(words) {
chain = {};
for (const word of words) {
addWordToChain(chain, word);
}
return chain;
}
/*
* Example: Adding "beat" to the chain will
function randomWord(chain, length) {
// get initial prefix
word = randomOccurance(chain, '');
for (var i = 0; i < length - 2; i++) {
lastTwoLetters = word.substr(-2);
// restart if chain hits dead end
if (chain[lastTwoLetters] == undefined) {
return randomWord(chain, length);
const fs = require('fs');
const alph = 'abcdefghijklmnopqrstuvwxyz'
demo();
function demo() {
try {
var fileContents = fs.readFileSync('./dictionary.txt', 'utf8');
} catch(err) {
throw "Dictionary file does not exist";
This file has been truncated, but you can view the full file.
A
A's
AMD
AMD's
AOL
AOL's
Aachen
Aachen's
Aaliyah
Aaliyah's
const fs = require('fs');
const alph = 'abcdefghijklmnopqrstuvwxyz'
try {
var fileContents = fs.readFileSync('./dictionary.txt', 'utf8');
} catch(err) {
throw "Dictionary file does not exist";
}
var words = fileContents.split('\n');
<!DOCTYPE html>
<html>
<head>
<style>
html {
font-family: Arial;
}
.shorten-output {
<!DOCTYPE html>
<html>
<head>
<style>
html {
font-family: Arial;
}
.shorten-options {
position: absolute;