Skip to content

Instantly share code, notes, and snippets.

View andyrudoff's full-sized avatar

Andy Rudoff andyrudoff

  • Intel
  • Boulder, CO
View GitHub Profile
@andyrudoff
andyrudoff / range.js
Last active March 2, 2023 14:28
javascript range() generator modeled after python
//
// range -- generator similar to python's range()
//
// range() will generate 0..MAX_SAFE_INTEGER
// range(end) will generate 0..(end-1)
// range(start, end) will generate start..(end-1)
// range(start, end, step) will step by step instead of 1
// start can be larger than end if step is negative:
// for example range(10, 2, -1)
//
#
# Makefile for force_4k example
#
PROGS = force_4k
CFLAGS = -g -Wall -Werror -std=gnu99
all: $(PROGS)
force_4k: force_4k.o
$(CC) -o $@ $(CFLAGS) $^ $(LIBS)
#!/usr/bin/env python
#
# ww -- calculate the current Intel work week (which is slightly different than ISO week)
#
import datetime
def ww(d):
# find first day of ww 1 by finding Jan 1 of
#include <sys/mman.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int
main(int argc, char *argv[])
@andyrudoff
andyrudoff / opendir_and_openat.c
Created January 11, 2019 20:53
trivial example showing how to use opendir+openat
/*
* opendir_and_openat.c -- trivial example showing how to use opendir+openat
*
* usage: a.out path-to-directory
*/
#include <stdio.h>
#include <dirent.h>
#include <err.h>
#include <fcntl.h>
*.o
tester
tickle_me_elmo.so
@andyrudoff
andyrudoff / .gitignore
Last active May 14, 2022 03:02
interpose on libc syscalls by code patching
*.o
tester
elmo.so
@andyrudoff
andyrudoff / OBJ_EXAMPLES.txt
Last active August 29, 2015 14:19
libpmemobj tutorial examples
Here are a sequence of examples used to introduce libpmemobj.
@andyrudoff
andyrudoff / README
Created November 17, 2014 04:52
libvmem examples
is a gist containing libvmem examples, so they can be embedded in web pages.
@andyrudoff
andyrudoff / README
Last active August 29, 2015 14:09
libpmemobj examples
This is a gist containing libpmemobj examples, so they can be embedded in web pages.