Skip to content

Instantly share code, notes, and snippets.

#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#define g(...) "g", h,##__VA_ARGS__
#define h(...) "o", i,##__VA_ARGS__
#define i(...) "o", h,##__VA_ARGS__
#!/usr/bin/env ruby
require 'continuation'
def newG(prefix = 'g')
proc do |tail = nil|
str = prefix
cont = nil
callcc{ |cc| cont = cc }
if tail == nil
str += 'o'
int main() {
int a = 1;
a += 2;
return a;
}
a.out:
(__TEXT,__text) section
_main:
0000000100000f70 pushq %rbp
0000000100000f71 movq %rsp, %rbp
0000000100000f74 movl $0x0, -0x4(%rbp)
0000000100000f7b movl $0x1, -0x8(%rbp)
0000000100000f82 movl -0x8(%rbp), %eax
0000000100000f85 addl $0x2, %eax
0000000100000f8a movl %eax, -0x8(%rbp)
#include <stdio.h>
int main() {
int si = -1;
unsigned int ui = 1;
printf("%d\n", si < ui);
}
Mail filters:
Process this with m4 to produce copy & pasteable output.
Keep in mind that multiple filters without an operator between them actually means logical and.
dnl
changequote(`[', `]')dnl
define([filter],
[patsubst(
translit([$1], [
], [ ]),
#define IF if(
#define THEN )
#define BEGIN {
#define END }
#define PRINT printf
#define GROUP (
#define ENDGROUP )
#define NEXT ;
@eatnumber1
eatnumber1 / struct-vla.c
Created October 28, 2013 09:12
An example of the use of VLA's in structs. A GNU C extension.
int main() {
int n = 1;
struct foo {
char a;
int b[n];
};
struct foo a;
a.a = 'a';
a.b[0] = 1;
n = 2;
@eatnumber1
eatnumber1 / qosctl.zsh
Created October 21, 2013 03:57
How I configure HFSC on my Linux router
#!/bin/zsh
emulate -L zsh
setopt err_exit warn_create_global no_unset
#setopt xtrace
#typeset -i UL_MAX=215040
#typeset -i UL_MAX=20480 # kbit/s
#typeset -i UL_MAX=16384 # kbit/s
typeset -i UL_MAX=17408 # kbit/s
#typeset -i UL_MAX=1800
#include <stdint.h>
#include <stdio.h>
#include <string.h>
int main() {
unsigned char foo_arr[9];
memset(foo_arr, 0, 9);
unsigned char *foo = foo_arr;
uint8_t a = 0xDE;
uint64_t b = 0xDEEFBEADDEEFBEADLL;