Skip to content

Instantly share code, notes, and snippets.

View ceberly's full-sized avatar

Chris Eberly ceberly

  • Middlebury Vermont
View GitHub Profile
@ceberly
ceberly / Makefile
Last active November 13, 2023 17:31
Row vs. Column access patterns
default:
gcc -O0 -g3 -Wall -Wextra -Wconversion -Wdouble-promotion \
-Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion \
main.c
format:
clang-format -i main.c
@ceberly
ceberly / generics.c
Created July 10, 2022 17:03
Generic db impl, in C
#include <stdlib.h>
#include <stdio.h>
// db.h
typedef struct DB {
void *private;
const char *(*get)(struct DB*);
} DB;
// test_db_impl.c
@ceberly
ceberly / do_it.sh
Created November 20, 2020 22:44
Ray Tracing in One Weekend, but you can see it in html
# run this in the same directory as the other files
# then navigate to localhost:8000/
python -m http.server 8000
# /localhost/query?terms=["a", "b", "c"]&limit=10&offset=20&sort="name"&sort_order="asc"
def query_request(params):
limit = params.get("limit", None)
offset = params.get("offset", 0)
sort_order = params.get("sort_order", "asc")
sort = params.get("sort", None)
terms = params.get("terms", [])
# do validation of things like empty terms,
# nonsense sort order ... usually inline.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ceberly
ceberly / http.lua
Created February 8, 2016 22:20
Seinfeld2000 RNN generator server
local async = require 'async'
local fiber = require 'async.fiber'
local torch = require 'torch'
local nn = require 'nn'
local nngraph = require 'nngraph'
local OneHot = require 'util.OneHot'
local misc = require 'util.misc'

Keybase proof

I hereby claim:

  • I am ceberly on github.
  • I am cde (https://keybase.io/cde) on keybase.
  • I have a public key whose fingerprint is C553 953C 3D81 4980 69F9 4BE1 88EE DE37 CFB3 E3B3

To claim this, I am signing this object:

// Most of this code is taken from https://github.com/davecheney/gpio/tree/master/examples/blink
// Please visit Dave's repo to learn about what it's doing.
package main
import (
"fmt"
"os"
"os/signal"
"time"