Skip to content

Instantly share code, notes, and snippets.

View frozencemetery's full-sized avatar
🌲
I'll be at a place until a time.

Robbie Harwood frozencemetery

🌲
I'll be at a place until a time.
View GitHub Profile

Keybase proof

I hereby claim:

  • I am frozencemetery on github.
  • I am rharwood (https://keybase.io/rharwood) on keybase.
  • I have a public key ASAAwudj_cmIdiDreBfovJkjcyEK0vK7VWDbZP9oI-52Ewo

To claim this, I am signing this object:

(0) frozencemetery@kirtar:~$ sml
Standard ML of New Jersey v110.76 [built: Sun Jun 29 03:29:51 2014]
- fun s m l = let val nj = l + 1 in (nj, if l = m then l else nj) end;
=========== K=6 ===========
1[1] <-->
2[2] <-->
3[3] <-->
5[5] <-->
6[6] <-->
8m{%8} <-->
#include <tevent.h>
#include <stdio.h>
#include <unistd.h>
#ifndef TEVENT_FD_ERROR
#define TEVENT_FD_ERROR 0
#endif /* TEVENT_FD_ERROR */
static int fds[2];
struct tevent_fd *tfd;
(0) rharwood@seton:~$ ./a.out
[tevent_loop_once]
[write_cb]
[tevent_loop_once]
[read_cb]
[tevent_loop_once]
[tevent_loop_once]
[timer_cb]; error!
{255} (0) rharwood@seton:~$
#include <tevent.h>
#include <stdio.h>
#include <unistd.h>
static void timer_cb(struct tevent_context *c, struct tevent_timer *e,
struct timeval ct, void *data) {
printf("[timer_cb]; error!\n");
exit(-1);
}
@frozencemetery
frozencemetery / coverity.h
Created September 6, 2018 19:40
coverity hack
#ifndef __COVERITY_GCC_VERSION_AT_LEAST
#define __COVERITY_GCC_VERSION_AT_LEAST(x, y) 0
#define FAKE__COVERITY_GCC_VERSION_AT_LEAST__
#endif /* __COVERITY_GCC_VERSION_AT_LEAST */
#ifdef __x86_64__
#if __COVERITY_GCC_VERSION_AT_LEAST(7, 0)
typedef float _Float128 __attribute__((__vector_size__(128)));
typedef float _Float64 __attribute__((__vector_size__(64)));
typedef float _Float32 __attribute__((__vector_size__(32)));
typedef float _Float64x __attribute__((__vector_size__(64)));

Keybase proof

I hereby claim:

  • I am frozencemetery on github.
  • I am frozencemetery (https://keybase.io/frozencemetery) on keybase.
  • I have a public key whose fingerprint is DEEE AD52 0FF9 9D23 251A 6730 194B 6528 EDB5 9881

To claim this, I am signing this object:

@frozencemetery
frozencemetery / beam.py
Created August 31, 2017 18:06
File: beam
#!/usr/bin/env python3
import subprocess
import sys
PRIMARIES = {"eDP1", "eDP-1", "LVDS1", "LVDS-1"}
def getoutputs():
res = subprocess.getoutput("xrandr")
outputs = {l.split()[0] for l in res.split("\n") if " connected" in l}
(defvar printed-p nil)
(defun has_nonzero (row)
(eq 0 (reduce #'logior row)))
(loop for row in X
for i from 0
while (not printed-p) do
(if (has_nonzero row)
(progn (print i)
(setf printed-p T))))
@frozencemetery
frozencemetery / monty.c
Last active December 29, 2015 09:39
Monty Hall simulator.
/* tested with --std=c99 and --std=gnu99 using gcc 4.7.2 and clang 3.0 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define ERROR(...) \
do { \
fprintf(stderr, __VA_ARGS__); \
fflush(stdout); \
exit(1); \