Skip to content

Instantly share code, notes, and snippets.

#define IF if(
#define THEN )
#define BEGIN {
#define END }
#define PRINT printf
#define GROUP (
#define ENDGROUP )
#define NEXT ;
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], [
], [ ]),
#include <stdio.h>
int main() {
int si = -1;
unsigned int ui = 1;
printf("%d\n", si < ui);
}
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)
int main() {
int a = 1;
a += 2;
return a;
}
#!/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'
#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__
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: CAPICUE.COM
Registrar: GOOGLE INC.
Whois Server: whois.rrpproxy.net
@eatnumber1
eatnumber1 / a.c
Last active August 29, 2015 14:09
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
int wins = 2;
char *s = "good ";
char *p = malloc(wins * strlen(s) + 1);
for (int i = 0; i < wins; i++) p = strcat(p, s);
printf("%s\n", p);
@eatnumber1
eatnumber1 / good.c
Last active August 29, 2015 14:09
The result of a challenge to write in C code that will do the following when run in Python: "good " * 2. I think I got a little carried away.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
for (char *s = "good ", l = strlen(s), z = 2 * l, d[z], *p = d; p == d + z ? *--p = 0, !puts(d) : 1; p = memcpy(p, s, l) + l);
}