Skip to content

Instantly share code, notes, and snippets.

View rramsden's full-sized avatar
♨️
Keep On Keeping On

Richard Ramsden rramsden

♨️
Keep On Keeping On
View GitHub Profile
#include "shared.h"
void consume_item(int item) {
// do something with item
}
int remove_item(int semid, int *shared_buffer) {
int index = get_buffer_size(shared_buffer) - 1;
int item = shared_buffer[index];
shared_buffer[index] = 0x00;
#include "shared.h"
/**
* returns current size of shared buffer
*/
int get_buffer_size(int *sbuff) {
int i = 0;
int counter = 0;
for (i = 0; i < BUFFER_SIZE; ++i) {
if (sbuff[i] == 0xFF) {
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#define BUFFER_SIZE 5
#define EMPTY_ID 0
ruby-1.8.7-p334 :003 > Typhoeus::Request.get("https://graph.facebook.com/me").body
=> ""
ruby-1.8.7-p334 :004 > Typhoeus::Request.get("https://graph.facebook.com/me", :disable_ssl_peer_verification => true).body
=> "{\"error\":{\"type\":\"OAuthException\",\"message\":\"An active access token must be used to query information about the current user.\"}}"
-module(test).
-compile(export_all).
-define(MILLISECONDS, 1).·
-define(SECONDS, 1000*?MILLISECONDS).
-define(MINUTES, 60*?SECONDS).
start() ->
io:format("minutes is ~p~n", [?MINUTES]),
io:format("is minutes an interger? ~p~n", [is_integer(?MINUTES)]),
-file("./test.erl", 1).
-module(test).
-compile(export_all).
-compile('P').
start() ->
io:format("minutes is ~p~n", [60 * 1000 * 1]),
# Information sent by the client at connection setup
#
# 1 byte-order
# #x42 MSB first
# #x6C LSB first
# 1 unused
# 2 CARD16 protocol-major-version
# 2 CARD16 protocol-minor-version
# 2 n length of authorization-protocol-name
# 2 d length of authorization-protocol-data
ruby-1.9.2-p290 :002 > X11::Display.new
00000000 01 00 0b 00 00 00 f3 00 a8 dc a7 00 00 00 00 05 |................|
00000010 ff ff 1f 00 00 01 00 00 14 00 ff ff 01 07 00 00 |................|
00000020 20 20 08 ff 00 00 00 00 54 68 65 20 58 2e 4f 72 | ......The X.Or|
00000030 67 20 46 6f 75 6e 64 61 74 69 6f 6e 01 01 20 00 |g Foundation.. .|
00000040 00 00 00 00 04 08 20 00 00 00 00 00 08 08 20 00 |...... ....... .|
00000050 00 00 00 00 0f 10 20 00 00 00 00 00 10 10 20 00 |...... ....... .|
00000060 00 00 00 00 18 20 20 00 00 00 00 00 20 20 20 00 |..... ..... .|
00000070 00 00 00 00 ac 00 00 00 20 00 00 00 ff ff ff 00 |........ .......|
00000080 00 00 00 00 34 00 5a 00 50 05 00 03 68 01 cb 00 |....4.Z.P...h...|
Uncaught exit(0) called, at Error
at Error (unknown source)
at __exit (http://interbutt.com/temp/motherofgod.html:30956:340)
at _exit (http://interbutt.com/temp/motherofgod.html:30956:373)
at _main (http://interbutt.com/temp/motherofgod.html:391:185)
at Object.callMain (http://interbutt.com/temp/motherofgod.html:31053:373)
at run (http://interbutt.com/temp/motherofgod.html:36077:176)
at http://interbutt.com/temp/motherofgod.html:36197:167
Title: Distributed Rate Limiting
Time: Tuesday April 3rd, 2012 @ 4:00 – 5:00 PM, followed by a Q&A and refreshments
Location: Building 356, Room 109
Speaker: Richard Ramsden (4th CSCI Student, Vancouver Island University)
Abstract:
The Distributed Rate Limiting (DRL) problem can be described as trying to distribute service capacity (“service rate”), expressed as a number of service requests per time interval, over a group of N servers in such a way that the amount given to each server C_i is dependent on the job population D_i at each server. We want to find a fair distribution of the service rate such that (D_i / C_i) is equal at every server. Creating a distributed algorithm to solve this problem is non-trivial since demand at each server is dynamic, i.e., changes with time. Furthermore, servers can fail for numerous reasons. Designing an algorithm which adapts quickly to change and is fault-tolerant is the main contribution of my research.