Skip to content

Instantly share code, notes, and snippets.

View ngerakines's full-sized avatar
🏠
Working from home

Nick Gerakines ngerakines

🏠
Working from home
View GitHub Profile
#include <cstdlib>
#include <deque>
#include <iostream>
#include <boost/bind.hpp>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
using namespace std;
using boost::asio::ip::tcp;
import os
import random
import tornado.httpserver
import tornado.ioloop
import tornado.web
names = ['Nick', 'Steve', 'Andy', 'Qi', 'Fanny', 'Sarah', 'Cord', 'Todd', 'Chris', 'Pasha', 'Gabe', 'Tony', 'Jason', 'Randal', 'Ali', 'Kim', 'Rainer']
def randline():
text = 'commit_messages.txt'
<a href="http://wow.mygamemug.com/register/user/?group_id=5158&t=BADGE_REF_CODE.izmUykZYhAwm4ykh6fzwIA"><img src="http://www.mygamemug.com/groups/7jYDfcV34TMZ/on-the-clock-lightbringer-us/badges/recruit.png" /></a>
/*
Copyright (c) 2010 Nick Gerakines <nick at gerakines dot net>
*/
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/queue.h>
#include <stdlib.h>
#include <err.h>
nowheremachine:heman nick$ make
make all-recursive
Making all in src
gcc -DHAVE_CONFIG_H -I. -I.. -Wall --std=c99 -fgnu89-inline -g -O2 -MT heman-heman.o -MD -MP -MF .deps/heman-heman.Tpo -c -o heman-heman.o `test -f 'heman.c' || echo './'`heman.c
heman.c: In function ‘on_read’:
heman.c:82: error: ‘bert_data_t’ has no member named ‘tuple’
make[2]: *** [heman-heman.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
@ngerakines
ngerakines / slug.erl
Created February 11, 2010 21:19
A small example in creating string slugs.
-module(slug).
-compile(export_all).
test() -> [
{slugify("Hello World"), "hello-world"},
{slugify(" HELLO *(^&)*(&* WORLD "), "hello-world"}
].
slugify(String) ->
slugify(String, []).
-module(spiral).
-compile(export_all).
%% -- if accumulator is empty, put first row into acc and continue
%% -- if last accum value is first value of row 1, put row one into accum and continue
%% -- if last accum value is last value of row one, collect all last row values into accum and continue
%% -- if last accum value is last value of last row, collect last row into accum and continue
%% -- if last accume value is first value of last row, collect first values into accum and continue
follow2() ->
%% Store username as binary
mnesia:transform_table(user, fun({user, Id, Name, Streak, Current, Last, Imp}) -> {user, Id, list_to_binary(Name), Streak, Current, Last, Imp} end, [id, username, longest_streak, current_streak, last_updated, importance], user).
%% Reference username and projects as binary
TransFun = fun({day, Id, Username, Date, Projects}) ->
{day, {list_to_binary(Username), Date}, list_to_binary(Username), Date, lists:usort([ list_to_binary(P) || P <- Projects])}
end.
[ begin [Record] = mnesia:dirty_read(day, Key), mnesia:dirty_delete_object(day, Record), mnesia:dirty_write(day, TransFun(Record)) end || Key <- mnesia:dirty_all_keys(day)].
local EDGEGAP, ROWHEIGHT, ROWGAP, GAP = 16, 19, 2, 4
-- Core reminders anchor.
-- ----------------------
local anchor = CreateFrame("Button", nil, UIParent)
local rows = {}
local text = anchor:CreateFontString(nil, nil, "GameFontNormalSmall")
text:SetPoint("CENTER")
{"ts" : "Tue Nov 03 2009 11:55:28 GMT-0800 (PST)" , "info" : "query iplaywar.gorfang ntoreturn:1 reslen:381 nscanned:1
query: { query: { name: \"Podgaz\" } } nreturned:1 bytes:365 124ms" , "millis" : 124}
{"ts" : "Tue Nov 03 2009 11:55:29 GMT-0800 (PST)" , "info" : "query iplaywar.gorfang ntoreturn:1 reslen:36 nscanned:0
query: { query: { name: \"Rrandd\" } } nreturned:0 bytes:20 100ms" , "millis" : 100}
{"ts" : "Tue Nov 03 2009 11:55:32 GMT-0800 (PST)" , "info" : "query iplaywar.volkmar ntoreturn:1 reslen:388 nscanned:1
query: { query: { name: \"Baalzephon\" } } nreturned:1 bytes:372 120ms" , "millis" : 120}
> db.system.profile.find().skip(180)
{"ts" : "Tue Nov 03 2009 11:53:31 GMT-0800 (PST)" , "info" : "query iplaywar.gorfang ntoreturn:1 reslen:379 nscanned:1
query: { query: { name: \"Sendintheworms\" } } nreturned:1 bytes:363 136ms" , "millis" : 136}
{"ts" : "Tue Nov 03 2009 11:53:42 GMT-0800 (PST)" , "info" : "query iplaywar.darkcrag ntoreturn:1 reslen:372 nscanned:1