Skip to content

Instantly share code, notes, and snippets.

@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);
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
#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;