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
# it's easy, in ruby, to setup a worker farm that utilizes processes, threads, | |
# or any combination. the following code sets up three processes, each with | |
# three worker threads, and a super simple, message passing api, to send | |
# messages to any process, which will use one of it's threads to do work | |
# | |
# | |
slaves = Array.new(3){ Slave.new{ Worker.new }} | |
workers = slaves.map(&:object) | |
a, b, c = workers |
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
function process_types(fmt :: String, args...) | |
# Process types of arguments for libc's printf family. | |
# Grab everybody's type. | |
types = [typeof(arg) for arg in args] | |
# Perform the following conversions: | |
# string -> Ptr{Uint8} (for %s) | |
# arrays -> Ptr{Void} (for %p) | |
types = map(t -> (t == ASCIIString ? Ptr{Uint8} : t), types) |
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
// This is a slight modification of the original at: | |
// http://www.cap-lore.com/Languages/const.c | |
// | |
// Does "int const *" refer to a constant pointer, or a constant integer? | |
// The following shows what gcc thinks. | |
// gcc 4 rejects any of the lines below that are commented out. | |
typedef const int * cip; | |
typedef int const * icp; | |
typedef int * const ipc; | |
typedef int const * const icpc; |
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
# | |
# perl got some things right. here-docs were one of them. YAML takes this | |
# further when we have to define large data structures. | |
# | |
# if you find yourself typing " ' ) ( [ ] too many times in a row, whack | |
# yourself on the wee-wee with a keyboard and whip out the YAML | |
# | |
this_fucking_licks_hairy_balls_to_edit = |