Skip to content

Instantly share code, notes, and snippets.

View onelson's full-sized avatar
🏠
Working from home

Owen Nelson onelson

🏠
Working from home
View GitHub Profile
@onelson
onelson / readme.md
Created August 26, 2022 19:29
Dynamic Pitch v2

Problem space: collections with varying items.

A contrived but valid bit of JSON data might look like:

[1, null, false, 2.0, "foo"]

Perhaps a more likely version of this problem is arrays of objects with varying fields:

@onelson
onelson / dse-driver-bindings.rs
Created August 10, 2019 04:48
dse-driver-bindings.rs
/* automatically generated by rust-bindgen */
pub const _STDINT_H: u32 = 1;
pub const _FEATURES_H: u32 = 1;
pub const _DEFAULT_SOURCE: u32 = 1;
pub const __USE_ISOC11: u32 = 1;
pub const __USE_ISOC99: u32 = 1;
pub const __USE_ISOC95: u32 = 1;
pub const __USE_POSIX_IMPLICITLY: u32 = 1;
pub const _POSIX_SOURCE: u32 = 1;
@onelson
onelson / streaming.md
Created December 2, 2018 00:01
On Streaming Setup.
@onelson
onelson / k8s-on-rpi3.md
Last active January 8, 2018 08:38
k8s on rpi3 notes

I've been reading [Kubernetes Up and Running], and got excited when I saw that they include some instructions for configuring a cluster on Raspberry Pis, which I've been dying to play with for some time but never had a project to dig into.

I had been recording my progress in the form of a [twitter thread][thread], but I thought something easier to scan, and editable, might be a better way to record the outcomes and lessons learned.

As I started to dig in, I found the short guide to be different enough what I was seeing (in reality) that I decided to keep some notes about the tweaks I was required to make.

@onelson
onelson / playground.rs
Created August 3, 2017 06:21 — forked from anonymous/playground.rs
Rust code shared from the playground
pub struct ChessGame {
model: Chess,
}
#[derive(Clone)]
struct Chess(u8);
impl ChessGame {
pub fn get(board_id: u8) -> ChessGame {
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y \
# stuff in case I need to debug/rebuild parts of the program
cmake \
build-essential \
sudo \
# runtime deps
libglu1-mesa \
libglew1.13 \
@onelson
onelson / Dockerfile
Last active November 6, 2016 20:53
So, I was looking for a way to test a new game project, built with cocos2d-x. I wanted to have the ability to verify that the build was portable (it is not) and also wanted to be able to build conveniently for 32 and 64 bit systems. Docker to the rescue?
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y \
# stuff in case I need to debug/rebuild parts of the program
cmake \
build-essential \
sudo \
# runtime deps
# TODO: either statically link these or wrap in a deb/rpm package to install these for the user
libglu1-mesa \
@onelson
onelson / Change.scala
Last active June 10, 2016 06:28 — forked from Apsu/change.py
SICP Scala Conversion
object Change {
def countChange(money: Int, coins: List[Int]): Int = {
def loop(goal: Int, xs: List[Int]): Int = {
if (goal == 0) 1
else if (goal <= 0) 0
else if (xs.isEmpty) 0
else loop(goal, xs.tail) + loop(goal - xs.head, xs)
}
loop(money, coins)
}
def users(): Future[List[User]] = {
val pl = Promise[List[User]]()
Future {
_roster.reloadAndWait()
val entries = _roster.getEntries().asScala.toList
val futures = entries map { entry =>
val pu = Promise[User]()
Future { // wrap all this stuff in the future just so it doesn't block
val target = entry.getUser()
connection.sendIqWithResponseCallback(ProfileIQ(target), new StanzaListener() {
@onelson
onelson / Infuse.scala
Created October 1, 2015 19:59 — forked from Apsu/infuse.py
Destiny Item Infusion Calculator
object Infuse {
final case class InfuseResult(light: Int, marks: Int, steps: Seq[Int]) {
def pretty: String = {
s"Light: $light, Marks: $marks, Infusion: ${steps.mkString(" -> ")}"
}
}
val COST = 3