Skip to content

Instantly share code, notes, and snippets.

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

Alexander Nenninger AlexanderNenninger

🏠
Working from home
  • NTT DATA
  • Berlin → München
  • 14:11 (UTC +02:00)
View GitHub Profile
@AlexanderNenninger
AlexanderNenninger / event_timer_cb.rs
Last active January 13, 2022 13:32
Callback to track time when last event occured. Written in Rust for referential transparency.
use std::boxed::Box;
type Callback<U, T> = Box<dyn Fn(&mut U, &T)>;
type Condition<U, T> = Box<dyn Fn(&U, &T) -> bool>;
type Effect<U, T> = Box<dyn Fn(&mut U, &T)>;
fn make_callback<U: 'static, T: 'static>(
condition: Condition<U, T>,
effect: Effect<U, T>,
) -> Callback<U, T> {
#!/usr/bin/env python3
import sys
import re
points = set()
folds = []
for line in sys.stdin:
line = line.strip()
@oJshua
oJshua / iso8601date.jl
Created October 20, 2019 05:08
Parse ISO8601 date string with 'Z' for UTC in Julia
using Dates
escaped_format = "yyyy-mm-dd\\THH:MM:SS.sss\\Z"
Zulu = String
Dates.CONVERSION_SPECIFIERS['Z'] = Zulu
Dates.CONVERSION_DEFAULTS[Zulu] = ""
df = Dates.DateFormat(escaped_format)
function convert_date(datestring::String)
Dates.parse(DateTime, datestring, df)