Skip to content

Instantly share code, notes, and snippets.

Simon-Martin Schröder moi90

  • Kiel, Germany
Block or report user

Report or block moi90

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View recursion_test.py
'''
Created on 06.12.2017
@author: mschroeder
'''
def create_tree(depth, n_children):
if depth > 0:
return [create_tree(depth - 1, n_children) for _ in range(n_children)]
@moi90
moi90 / write_pgm.c
Created Nov 24, 2016
Save an image consisting of unsigned chars to a pgm file
View write_pgm.c
void write_pgm(unsigned short id, unsigned char *buf, int width, int height) {
char filename[1024];
sprintf(filename, "%simage_%d.pgm", destinationPrefix, id);
FILE *fp = fopen(filename, "wb");
if (fp) {
fprintf(fp, "P5\n%d %d\n%d\n", width, height, 0xFF);
fwrite(buf, width * height, 1, fp);
fclose(fp);
You can’t perform that action at this time.