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
// Übungsbeispiel Stöhr | |
// man sollte erst versuchen es selbst zu lösen und dann das hier zu lösen. | |
// (Ich bin mir nicht sicher was schwerer ist :-)) | |
// Sind vermutlich ein paar Fehler drin - einfach unten posten. | |
// (Anmerkung: Die Kommentare sind nicht von Prof. Stöhr) | |
#include <stdio.h> | |
/* Ein Array aus Strings */ | |
char *c[] = {"ENTER", "NEW", "POINT", "FIRST"}; |
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
// Kurzes Beispiel wie man die Member einer Template Klasse | |
// doch noch auslagern kann - vor Gebrauch in Datein aufsplitten :-) | |
// Kompilieren mit: g++ template_main.cc template.cc template.hh -Wall -Wextra | |
// | |
// Das ganze ist etwas unschön. Was lernen wir daraus? | |
// Das gleiche wie bei 'new' templates nur benutzen wenn's | |
// wirklich begründet ist. | |
// ~c3 | |
//=================================== |
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 <glib.h> | |
#include <stdlib.h> | |
#include <string.h> | |
static void foreach_file(const gchar * song_dir_path, const gchar * regex); | |
static gboolean path_go_up(char * song_dir_path); | |
static void find_in_musictree(const gchar * song_file_path, const gchar * regex, gint up_to); | |
//--------------------------------------------------- |
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
require 'find' | |
require 'tempfile' | |
$license = <<-eos | |
/* Cats insert there license here | |
* Hmm. Replace this. | |
*/ | |
eos | |
# Insert license at beginning, using a crappy tmp file. |
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
def randomize str | |
out = "" | |
pos = (0..str.length-1).to_a | |
pos.each do |num| | |
new_pos = rand(str.length-1) | |
# Swap | |
tmp = pos[num] | |
pos[num] = pos[new_pos] |
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 java.lang.Math; | |
import java.util.Arrays; | |
class A3 extends Thread { | |
private static final int N = 3; | |
private int myid = 0; | |
public volatile static Integer array[] = {0,0,0}; | |
A3(int i) |
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 <glyr/glyr.h> | |
#include <glyr/cache.h> | |
#include <glib.h> | |
#include <stdlib.h> | |
void do_insert(GlyrQuery * q, GlyrDatabase * db, char * artist, char * album, char * title) | |
{ | |
glyr_query_init(q); | |
glyr_opt_artist(q,artist); | |
glyr_opt_album(q,album); |
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 <fts.h> | |
#include <glib.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/stat.h> | |
typedef struct | |
{ | |
char * path; |
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
// g++ MemPool.cc $(pkg-config --libs --cflags glib-2.0) -Wall -Wextra -pedantic | |
#include <glib.h> | |
#include <algorithm> | |
template<class StorageClass> | |
class UseMemPool | |
{ | |
public: | |
void * operator new(size_t size) |
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/env python | |
import os, sys, time | |
def find_next_free_x_display(max_tries = 10): | |
""" | |
Find the next free X Display by | |
investigating the Xlocks in /tmp | |
""" | |
for i in range(max_tries): |