Skip to content

Instantly share code, notes, and snippets.

View seanjensengrey's full-sized avatar

Sean Jensen-Grey seanjensengrey

View GitHub Profile
@seanjensengrey
seanjensengrey / rust-python-cffi.md
Last active April 3, 2024 11:55
Calling Rust from Python/PyPy using CFFI (C Foreign Function Interface)

This is a small demo of how to create a library in Rust and call it from Python (both CPython and PyPy) using the CFFI instead of ctypes.

Based on http://harkablog.com/calling-rust-from-c-and-python.html (dead) which used ctypes

CFFI is nice because:

  • Reads C declarations (parses headers)
  • Works in both CPython and PyPy (included with PyPy)
  • Lower call overhead than ctypes
@seanjensengrey
seanjensengrey / tiny.c
Last active March 25, 2024 16:46
Marc Feeley Tiny C compiler
/* file: "tinyc.c" */
/* originally from http://www.iro.umontreal.ca/~felipe/IFT2030-Automne2002/Complements/tinyc.c */
/* Copyright (C) 2001 by Marc Feeley, All Rights Reserved. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
@seanjensengrey
seanjensengrey / octal_x86.txt
Created April 1, 2018 16:28
x86 is an octal machine
# source:http://reocities.com/SiliconValley/heights/7052/opcode.txt
From: mark@omnifest.uwm.edu (Mark Hopkins)
Newsgroups: alt.lang.asm
Subject: A Summary of the 80486 Opcodes and Instructions
(1) The 80x86 is an Octal Machine
This is a follow-up and revision of an article posted in alt.lang.asm on
7-5-92 concerning the 80x86 instruction encoding.
The only proper way to understand 80x86 coding is to realize that ALL 80x86
@seanjensengrey
seanjensengrey / configuration.nix
Last active February 16, 2024 16:18
Nixos with raid-0 root partition using mdadm
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
# Download graphical ISO, http://nixos.org/nixos/download.html
# if you want to do an install over an SSH connection
# $ systemctl start sshd.service
# $ useradd remoteinstaller
# $ passwd remoteinstaller

Notes on writing a Lua Bytecode VM. Lua is a compact, minimal language designed for embedding within a larger program to provide end-user customization of program behavior. This note outlines how I would breakdown implmementing the Lua Bytecode VM in Rust. The techniques are broadly applicable to any implementation language.

I would proceed by supporting a subset of Lua that uses only numbers then move on to tables with numbers. Lua 5.3 adds integers.

Form small tests cases, compile chunks of lua code and

The Bitter Lesson

Rich Sutton, March 13, 2019 http://incompleteideas.net/IncIdeas/BitterLesson.html

The biggest lesson that can be read from 70 years of AI research is that general methods that leverage computation are ultimately the most effective, and by a large margin. The ultimate reason for this is Moore's law, or rather its generalization of continued exponentially falling cost per unit of computation. Most AI research has been conducted as if the computation available to the agent were constant (in which case leveraging human knowledge would be one of the only ways to improve performance) but, over a slightly longer time than a typical research project, massively more computation inevitably becomes available. Seeking an improvement that makes a difference in the shorter term, researchers seek to leverage their human knowledge of the domain, but the only thing that matter

arxiv-ml

I have a tuple of 3 numbers that I would like to predict a final value. The first row is the one I would like to complete with the value ? the other two rows are training data. Could you find the missing value or a way to approximate it?

(2607, 2671, 1975) = ?
(2495, 2488, 1879) = 28644
(2269, 2263, 1597) = 26513

ChatGPT4 estimated the following number of papers for 2023

class StackModule:
def __init__(self):
self.items = []
def __repr__(self):
return repr(self.items)
def push(self, value):
self.items.append(value)
Logo Memo 1 AIM-246.pdf A Computer Laboratory For Elementary Schools
Logo Memo 2 AIM-247.pdf Teaching Children Thinking
Logo Memo 3 AIM-248.pdf Twenty Things To Do With A Computer
Logo Memo 4 AIM-249.pdf Teaching Children To Be Mathematicians vs. Teaching About Mathematics
Logo Memo 5 AIM-254.pdf NIM: A Game-Playing Program
Logo Memo 6 AIM-264.pdf Developing A Musical Ear: A Ne