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 <stdio.h> | |
#include <setjmp.h> | |
struct Exception { | |
jmp_buf jb; | |
int code; | |
}; | |
/* Definitely not thread-safe... But we don't care :-) */ | |
struct Exception *cur_ex_ptr = 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 <stdio.h> | |
#include <stdint.h> | |
#define CHR(in) ((in) > 25 ? (in)+6 : (in)+65) | |
int main(int argc, char **argv) | |
{ | |
int i; | |
uint64_t data = 976561444569328775LU; | |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <memory.h> | |
#include <stdint.h> | |
#define VECTOR_EXPORT(SYM) SYM | |
struct VECTOR_EXPORT(vector) { | |
uint32_t elmsize; | |
uint32_t capacity; |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <limits.h> | |
#include <time.h> | |
/* Lookup array for card suits */ | |
const char *card_suits[] = { | |
"hearts", | |
"diamonds", |
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
# | |
# Simple Nearest Neighbor Scaling Algorithm | |
# | |
# @author Cameron Eure | |
# @license Public Domain | |
# | |
import os, sys, copy |
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
import os, sys, copy, imagekit | |
class RGB_Sample(object): | |
def __init__(self, r, g, b): | |
self.set_value(r, g, b) | |
def set_value(self, r, g, b): | |
if r > 255: | |
r = 255 |
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
from imagekit import * | |
i = ImageBuffer.fromJPEG('seattle.jpg') | |
# Darken, and pallete swap (emerald) | |
darken = [ | |
0.00, 0.00, 0.00, | |
0.16, 0.16, 0.16, | |
0.16, 0.16, 0.16] |
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
There are 7 different tetrominoes in Tetris. | |
The 7-bag system works by shuffling an array with one of each tetromino. | |
There are about 5040 possible combinations of tetrominos in this system. | |
Here's every possible permutation: | |
1 2 3 4 5 6 7 | |
1 2 3 4 5 7 6 | |
1 2 3 4 6 5 7 | |
1 2 3 4 6 7 5 |
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
""" | |
Tool that outputs the NES Color Palette to a PNG file. | |
""" | |
import math | |
from imagekit import * |
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 <stdint.h> | |
// GPIO pins used for connected gamepad | |
#define CLOCK 21 | |
#define LATCH 20 | |
#define DATA 19 | |
#define DEVICE_TYPE_NES 0 | |
#define DEVICE_TYPE_SNES 1 |
OlderNewer