View glyr_opt_dlcallback.rb
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 './glyros.so' | |
q = Glyros::GlyrQuery.new | |
Glyros::glyr_query_init(q) | |
Glyros::glyr_opt_artist(q,"Equilibrium") | |
Glyros::glyr_opt_type(q,Glyros::GLYR_GET_ARTIST_PHOTOS) | |
Glyros::glyr_opt_number(q,5) | |
my_proc = Proc.new do |cache,query| | |
Glyros::glyr_cache_print cache |
View glyr_dbtest.rb
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 './glyros.so' | |
include Glyros | |
# Brief example on how to use glyr_db_foreach() and the require macros | |
# Sorry if this looks like Ruby. It's acutally ruby-flavoured C :-) | |
# A filled DB is required, read to use example: | |
# $ glyrc artistphotos -a "Bring me the horizon" -n 10 -c /tmp | |
# Gets the 'requirements' for a certain fetcher by it's type |
View glyr_providertest.rb
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 './glyros.so' | |
include Glyros | |
# Simple example on how to directly call a certain | |
# provider's get_url() and parser() function. | |
# We need a query (as usual) | |
q = GlyrQuery.new | |
glyr_query_init(q) | |
glyr_opt_artist(q,"Equilibrium") |
View glyr_reqs.rb
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 './glyros.so' | |
include Glyros | |
# Simple example on how to use glyr_info_get | |
# and the require macros appear here too. | |
def req_to_string reqs, required, optional | |
return "required" if (reqs & required) != 0 | |
return "optional" if (reqs & optional) != 0 | |
return "not needed" |
View stoehr.cpp
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"}; |
View template_auslagern.cc
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 | |
//=================================== |
View musictree.c
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); | |
//--------------------------------------------------- |
View license.rb
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. |
View kittenizer.rb
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] |
View A3.java
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) |
OlderNewer