Skip to content

Instantly share code, notes, and snippets.

View RCHowell's full-sized avatar
🐙
Gardening

R. C. Howell RCHowell

🐙
Gardening
View GitHub Profile

[Schema]

val schema = Frameworks.createRootSchema(false)
val playersType = RelDataTypeFactory.Builder(typeFactory)
  .add("id", SqlTypeName.INTEGER)
  .add("fname", SqlTypeName.VARCHAR)
  .add("lname", SqlTypeName.VARCHAR)
  .add("age", SqlTypeName.DOUBLE)
  .add("weight", SqlTypeName.DOUBLE)
 .add("height", SqlTypeName.DOUBLE)
@RCHowell
RCHowell / mandelbrot_gif.go
Created February 27, 2020 04:03
Generate a gif of the mandelbrot set while varying the palette per frame
package main
import (
"image"
"image/color"
"image/color/palette"
"image/gif"
"math"
"math/cmplx"
"os"
@RCHowell
RCHowell / parse-note.go
Created November 14, 2019 02:38
Parse Exported Google Keep Data
package main
import (
"bufio"
"fmt"
"os"
"golang.org/x/net/html"
)
@RCHowell
RCHowell / homology.py
Last active September 13, 2022 08:40
Computing the Homology of a Simplicial Complex
import numpy as np
import functools as func
import itertools as itertools
# spcx::Set<Tuple> --> int
def vertex_count(spcx):
# Reduce Set to max value amongst Tuples in the set
return func.reduce(lambda acc, e: max(acc, max(e)), spcx, 0) + 1
# spcx::Set<Tuple>, n::int --> Dict<Tuple, int>
@RCHowell
RCHowell / huffman.js
Created January 7, 2019 06:47
Javascript Huffman Code Algorithm
// Test Information Source from
// 'Introduction to Coding & Information Theory'
// By Steven Roman 1997
// This is a method I came up with while solving exercise 2.2.7
// All bets are off on optimization, but it's not too shabby
// Example Information Source
const infoSourceNodes = [
{symb: 'a', prob: 0.35},
@RCHowell
RCHowell / birthday.js
Last active September 25, 2017 00:39
Simulating Unique Birthdays out of N people
// Usage
// node birthday.js <TRIALS> <PEOPLE>
const TRIALS = process.argv[2];
const PEOPLE = process.argv[3];
// Using a Map to count uniqueness in linear time
let counts = {};
let uniqueTotal = 0;
@RCHowell
RCHowell / socketio.js
Created August 19, 2017 04:02
Socket.io Types
// sending to sender-client only
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender