Skip to content

Instantly share code, notes, and snippets.

io12

Block or report user

Report or block io12

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View spim-syscall.h
#define _SPIM_NR_PRINT_INT 1
#define _SPIM_NR_PRINT_FLOAT 2
#define _SPIM_NR_PRINT_DOUBLE 3
#define _SPIM_NR_PRINT_STRING 4
#define _SPIM_NR_READ_INT 5
#define _SPIM_NR_READ_FLOAT 6
#define _SPIM_NR_READ_DOUBLE 7
#define _SPIM_NR_READ_STRING 8
#define _SPIM_NR_SBRK 9
#define _SPIM_NR_EXIT 10
View everything.c
#include <values.h>
#include <features.h>
#include <gnu-versions.h>
#include <stdc-predef.h>
#include <gnu/stubs.h>
#include <gnu/stubs-64.h>
#include <gnu/libc-version.h>
#include <gnu/lib-names.h>
#include <gnu/lib-names-64.h>
#include <iconv.h>
View stopwatch.sh
#!/bin/sh
# Adapted from <https://superuser.com/a/611582>
date1=$(date +%s)
while true; do
s="$(date -u --date @$(($(date +%s) - date1)) +%H:%M:%S)"
printf "%s\r" "$s"
sleep 0.1
View lazy_eval.c
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
typedef void *(ThunkFunc)(void *);
typedef struct thunk Thunk;
struct thunk {
void *result;
ThunkFunc *func;
View find_first_utf8_char.c
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, const char *argv[])
{
FILE *fp;
int c;
unsigned int lineno = 1, colno = 1;
View four_gigabyte_l.c
// Prints a 4GB 'L'
#include <limits.h>
#include <stdio.h>
int main(void)
{
int i;
putchar('L');
View func.h
/*
$----------------$
| Example usage: |
$----------------$------------------------------------------------------$
| #include <stdbool.h> |
| #include <stdio.h> |
| |
| #include "func.h" |
| |
| LIST_TYPE(int) |
View type.c
#include <stdio.h>
#include <stdlib.h>
#define LEN(x) (sizeof(x) / sizeof(x[0]))
/*
* Declare `arr`, an array of four pointers to arrays of two function pointers
* to a function that accepts a pointer to a two by two two dimensional array
* of ints as a parameter and returns an int.
*/
View gen_a_billion_laughs.c
#include <limits.h>
#include <stdio.h>
int main(void)
{
int i, j, c;
printf("typedef void (*a)(void);\n");
for (i = 0; i < 25; i++) {
c = i + 'a';
View a_billion_laughs.h
#define a b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b
#define b c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c
#define c d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d
#define d e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e e
#define e f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
You can’t perform that action at this time.