Skip to content

Instantly share code, notes, and snippets.

View jrosskopf's full-sized avatar

Joachim Rosskopf jrosskopf

View GitHub Profile
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define MIN_RAND_NUMBER 10
#define MAX_RAND_NUMBER 60
#define STATE_YOU 0
#define STATE_BOT 1
@jrosskopf
jrosskopf / macros.h
Created November 9, 2011 16:56
05_song
#define Y you
#define ILA I look at
#define ILAYA ILA you all
#define IDK I dont know
#define HYW how Y were
#define WSMGGW(x) x my guitar gently weeps
@jrosskopf
jrosskopf / 07_soupsum.c
Created November 14, 2011 13:15
07_soupsum
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
//#define DEBUG
#define EOT 4
#define TO_CHAR(_x) ((unsigned char)_x)
#define TO_NUMBER(_x) ((_x >= '0' && _x <= '9') ? (double)(_x - '0') : 0.0)
#define SIGNUM(_x) (signbit(_x) ? -1.0 : 1.0)
@jrosskopf
jrosskopf / 08_hangman.c
Created November 23, 2011 16:14
08_hangman
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define TO_CHAR(_x) ((unsigned char)_x)
#define MAX_LINE_LENGTH 1024
@jrosskopf
jrosskopf / 09_cachedetect.c
Created November 30, 2011 06:06
09_cachedetect
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/resource.h>
#include <sys/times.h>
#include <time.h>
#include <unistd.h>
#define KB (1024 * sizeof(char))
@jrosskopf
jrosskopf / linked_list_management.c
Created December 12, 2011 17:40
10_speicherverwaltung
#include "linked_list_management.h"
void add_page_to_pool_free_list(mem_pool *pool, mem_page *new_page) {
mem_page *current_page = pool->free_pages;
if (current_page == NULL) {
pool->free_pages = new_page;
return;
}
@jrosskopf
jrosskopf / reverse.c
Created December 21, 2011 11:42
11_reverse
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DEFAULT_LINE_BUFFER_LENGTH 1024
#define DEFAULT_LINE_BUFFER_INCREMENT DEFAULT_LINE_BUFFER_LENGTH
#define ARG_IS_NOT_SEARCH_WORD "-x"
@jrosskopf
jrosskopf / reverse2.c
Created January 8, 2012 13:03
12_reverse2
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define EOL '\n'
#define DEFAULT_LINE_BUFFER_LENGTH 1024
#define DEFAULT_LINE_BUFFER_INCREMENT DEFAULT_LINE_BUFFER_LENGTH
@jrosskopf
jrosskopf / bot_karl.c
Created January 23, 2012 15:01
13_four
#include "bot_karl.h"
bool bot_karl_ready_to_work = false;
void intialize_bot_karl(pt_four_wins_ctx ctx) {
//printf("Bot Karl intialized\n");
srand(time(NULL));
bot_karl_ready_to_work = true;
}
@jrosskopf
jrosskopf / Makefile
Created January 23, 2012 15:04
14_dups
CFLAGS = -Wall -g -std=gnu99
LFLAGS = -R/usr/local/lib -lm
SHARED = -fPIC -shared
CC = gcc
DEPENDFILE = .dependencies
SRC = dups.c hashtable.c
SHSRC =
OBJ = $(SRC:%.c=%.o)
SHOBJ = $(SHSRC:%.c=%.so)