Skip to content

Instantly share code, notes, and snippets.

@kelsey-sorrels
kelsey-sorrels / Mastodon Message License v1
Created January 17, 2023 07:15
Mastodon Message License v1
Mastodon Message License
This license applies to all Mastodon messages posted by the message author (the "Messages"). By accessing or using the Messages, you agree to be bound by the terms of this license.
Prohibited Uses. You may not use the Messages for any purpose that involves indexing for full-text search of the Messages, or using them in quote replies. However, you may store the Messages by hashtag for personal or non-commercial use.
Attribution. You must give appropriate credit to the message author as the original creator of the Messages, but you are not required to include a specific attribution statement or link.
Disclaimer of Warranties. The Messages are provided "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
@kelsey-sorrels
kelsey-sorrels / requirements.txt
Last active June 5, 2019 05:13
Predict Spectral Class From Absolute Magnitude and Color Index
# brew update && brew install gcc (this includes gfortran)
ipython[all]>=3.2.0
scikit-learn>=0.21.2
matplotlib>=3.1.0
pandas>= 0.24.2
@kelsey-sorrels
kelsey-sorrels / main.py
Last active January 26, 2019 21:09
Poset-0
from graphviz import Digraph
import numpy as np
import funcy
import random
from enum import Enum
# number of nodes in each layer
# must be odd
shape = [1, 3, 5, 5, 5, 5, 3, 1]
rows = len(shape)
@kelsey-sorrels
kelsey-sorrels / gist.scala
Last active January 19, 2018 12:41
Shapeless Recursive Coproduct
import matryoshka._
import matryoshka.data._
import matryoshka.implicits._
import shapeless._
type SF[A] = Boolean :+: Int :+: String :+: List[A] :+: Map[String, A] :+: CNil
val v0 = Coproduct[SF[Nothing]](1)
@kelsey-sorrels
kelsey-sorrels / gmm.scala
Last active July 6, 2017 15:58
GMM Identical Clusters
import org.apache.spark.SparkContext
import org.apache.spark.rdd._
import org.apache.spark.mllib.clustering.GaussianMixture
import org.apache.spark.mllib.linalg.{Vector, Vectors}
def sparkContext: SparkContext = {
import org.apache.spark.SparkConf
new SparkContext(new SparkConf().setMaster("local[*]").setAppName("console"))
}
@kelsey-sorrels
kelsey-sorrels / Main.scala
Created June 18, 2016 03:00
For/yield followed by match
import scala.util.{Try, Success, Failure}
// Where this syntax scans
(for {
x <- Try("3".toInt)
y <- Try("4".toInt)
} yield {
x + y
}) match {
case Success(n) => println(n)
@kelsey-sorrels
kelsey-sorrels / core.clj
Created June 4, 2016 04:12
Clojure TTF
(ns ttftest.core
(:require
[taoensso.timbre :as log]
[clojure.java.io :as jio])
(:import
(java.nio ByteBuffer)
(org.lwjgl BufferUtils)
(org.lwjgl.system MemoryStack)
(org.lwjgl.stb STBTruetype STBTTFontinfo)
(org.apache.commons.io IOUtils)))
@kelsey-sorrels
kelsey-sorrels / LWJGL3Test.java
Created June 1, 2016 02:23
Java translation of Clojure code
package example;
import org.lwjgl.BufferUtils;
import org.lwjgl.stb.STBTruetype;
import org.lwjgl.stb.STBTTFontinfo;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.nio.channels.FileChannel;
/**
* A Processing implementation of izhikevich spiking neural network.
* http://www.izhikevich.org/publications/spikes.pdf
* By Aaron Santos
*/
import java.util.Set;
import java.util.HashSet;
import org.dishevelled.processing.executor.Executor;
import java.util.concurrent.TimeUnit;
@kelsey-sorrels
kelsey-sorrels / gist:3944237
Created October 24, 2012 05:35
GeoJSON example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.