This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// memory.txt - a HL-ZASM malloc implementation | |
// by Rikki "R2ZER0" Guy 2012-13 | |
// Released into the public domain. | |
// Usage: | |
// first call heap_format(ptr, size); | |
// where ptr in the pointer to a block of memory to be used as a heap | |
// and size is the size of the heap (in bytes) | |
// A simple way is to use __PROGRAMSIZE__ as a heap pointer | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function matchAirport($str) | |
{ | |
$result = array(); | |
if(preg_match('/\(([A-Z]{3})\)\s-\s[A-Z]{2}/', $str, $matches)) | |
{ | |
$result["type"] = "airport"; | |
$result["iata_code"] = $matches[1]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Example usage */ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include "foo.h" | |
void main(void) | |
{ | |
Foo my_foo = new_foo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "bar.h" | |
#include <stdlib.h> | |
void bar_init(struct bar* self, | |
int member1) | |
{ | |
self->member1 = member1; | |
self->member2 = "Hello, World!"; | |
self->member3 = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
typedef struct { | |
unsigned long val : 48; | |
} uint48; | |
uint48 add48(uint48 a, uint48 b) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <GL/gl.h> | |
#include <GL/glu.h> | |
#include <GL/glut.h> | |
// See: http://nehe.gamedev.net/tutorial/lessons_01__05/22004/ | |
/* Render a frame */ | |
void DrawGLScene(void) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
(sub { print "arg"; })(); |