Skip to content

Instantly share code, notes, and snippets.

View jonathanstrong's full-sized avatar

Jonathan Strong jonathanstrong

  • Washington, D.C.
View GitHub Profile
@jonathanstrong
jonathanstrong / isolated-rhai-panic-example.rs
Created March 4, 2022 03:04
rhai panic isolated example
use std::sync::Arc;
use chrono::prelude::*;
use chrono_tz::US::Eastern;
use rhai::{Engine, EvalAltResult, Scope, FnPtr, NativeCallContext};
#[derive(Clone)]
pub struct Ts {
time: Vec<u64>,
data: Vec<f64>,
}
@jonathanstrong
jonathanstrong / Cargo.toml
Created May 6, 2021 19:05
failed attempt at designing event loop around rio's interface
[package]
name = "rio-event-loop-attempt"
version = "0.1.0"
edition = "2018"
[dependencies]
rio = "0.9.4"
slab = "0.4.3"
crossbeam-channel = "0.5"
libc = "0.2.68"
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:95% !important; } div.output_wrapper .output { padding-left: 14px; }</style>"))
@jonathanstrong
jonathanstrong / loop.rb
Last active March 22, 2019 07:01
ruby simple event loop with ctrl-c handling
#!/usr/bin/ruby
require 'date'
# see also https://github.com/socketry/nio4r
last = Time.now.utc
stop = false
trap("SIGINT") do
@jonathanstrong
jonathanstrong / multiqueue.rs
Created March 14, 2018 02:42
multiqueue bench
#![feature(duration_from_micros)]
extern crate hdrhistogram;
extern crate multiqueue;
extern crate chrono;
extern crate libc;
extern crate hwloc; // tested with v0.3
extern crate rand;
use std::sync::{Arc, Mutex};