Skip to content

Instantly share code, notes, and snippets.

@jelford
jelford / read_numerai_dataset_by_era.py
Last active April 21, 2023 14:42
Read Numerai dataset by Era
import pyarrow.dataset as ds
def load(source_file: str, eras=None, features=None) -> pd.DataFrame:
source_file = str(source_file)
if eras is None:
eras = eras_from_file(source_file)
if features is None:
features = feature_names(source_file)
@jelford
jelford / self-pipe-trick.c
Last active April 14, 2024 09:52
a short snippet demonstrating djb's self-pipe trick in c
// compiles with: gcc -Wall -Werror -pedantic ./selfpipetrick.c -o selfpipetrick
// You can quit by suspending with Ctrl-Z and then sending a `kill -9`
#include <sys/signalfd.h>
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
@jelford
jelford / signalfd.c
Created October 31, 2021 12:20
A small app that demonstrates using signalfd to handle signals in a normal thread context
// Error handling omitted for brevity
// compile with: gcc signalfd.c -o signalfd
#include <sys/signalfd.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <poll.h>
@jelford
jelford / Cargo.toml
Created April 4, 2021 16:12
Signal-Handling-Raw
[package]
name = "example"
version = "0.1.0"
authors = ["James Elford <james.p.elford@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
libc = "0.2"
@jelford
jelford / Contailerfile
Created August 21, 2020 09:16
Toolbox for setting up RingCentral Meetings
FROM registry.fedoraproject.org/f32/fedora-toolbox:latest
RUN set pipefail && \
dnf update --all -y && \
curl -sSLo "ringcentral_x86_64.rpm" "https://ringcentral.zoom.us/client/latest/ringcentral_x86_64.rpm" && \
dnf localinstall -y "ringcentral_x86_64.rpm" && \
dnf clean all
# build with `podman build -t ringcentral-image .
# init toolbox with `toolbox create -i ringcentral-image -c ringcentral
@jelford
jelford / log.css
Last active August 29, 2015 13:57
Quick and dirty log panel when console.log isn't available
#log {
max-height: 10em;
height: 10em;
overflow-y: scroll;
position: fixed;
right: 0;
top: 0;
@jelford
jelford / jmock_abstract_collecitons.java
Last active December 22, 2015 10:49
This will bite you if you use Guava's ImmutableX types.
public class AppTest
{
@Rule public JUnitRuleMockery context = new JUnitRuleMockery();
public static interface ColGetter {
public abstract Col get();
}
public static interface NonColGetter {
public abstract NonCol get();