Skip to content

Instantly share code, notes, and snippets.

View KristianLyng's full-sized avatar

Kristian Lyngstøl KristianLyng

  • Amedia
  • Oslo
View GitHub Profile
kristian@luke:~$ cat foo.c
#include <stdio.h>
void test_function(int i)
{
printf("This function does nothing\n");
}
int main(void)
{
kristian@luke:~$ cat foo.c
#include <stdio.h>
void test_function(int i)
{
printf("This function does nothing\n");
}
int main(void)
{
ristian@luke:~$ cat foo.c
#include <stdio.h>
void test_function(int i)
{
printf("This function does nothing\n");
}
int main(void)
{
conf/distributions
Origin: NNP
Suite: stable
Codename: nnp
Components: main
Architectures: amd64
SignWith: yes
test=2;
printf("%s\n", test == 2 ? "TRUE" : "FALSE");
printf("%s\n", !test == !2 ? "TRUE" : "FALSE");
Output:
~$ gcc foo.c
~$ ./a.out
FALSE
TICK TOCK
Proto stats for WEB: 3
Proto stats for SSH: 24
TICK TOCK
Proto stats for WEB: 4
Proto stats for SSH: 25
TICK TOCK
Proto stats for WEB: 4
Proto stats for SSH: 26
//////////////////////////////////////////////////////////////////////////////////
int load
(
const char *path, // The path of the def file
struct trie_tree **tree_out // Tier tree (out)
)
//
// Description:
//
// Loads the def file
@KristianLyng
KristianLyng / HELLO-WORLD.cobol
Created June 10, 2013 16:32
This is what the world has been waiting for: Integration of COBOL and Varnish. http://kly.no/varnish/cobol.png
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY 'Hello, world'.
kristian@edwin:~$ cat foo2.c; gcc foo2.c; ./a.out
#include <stdio.h>
int main(void) {
int i = 10;
while (i --> 0)
printf("%d ", i);
putchar('\n');
}
9 8 7 6 5 4 3 2 1 0
kristian@edwin:~$
#include <stdio.h>
#define test(n, op) do { \
int value; \
printf("Take %d (%s, x: %d, y: %d)\n", n, #op, x,y); \
printf(#op ": %s ", (value = op) ? "TRUE" : "FALSE"); \
printf(" X: %d Y: %d\n\n", x, y); \
} while(0)
int main(void) {