Skip to content

Instantly share code, notes, and snippets.

Brian L. Troutwine blt

Block or report user

Report or block blt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View piper.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
int main(int argc, char *argv[]) {
int pfd0[2], pfd1[2];
pid_t ls_pid, wc_pid, wc1_pid;
pipe(pfd0);
We couldn’t find that file to show.
View echo.erl
-module(echo).
-export([listen/1, accept/1]).
-define(TCP_OPTIONS, [binary, {active, false}]).
listen(Port) ->
{ok, Socket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
accept(Socket).
accept(LSocket) ->
{ok, Socket} = gen_tcp:accept(LSocket),
View Course.py
import web, models
from util import crs_obj, dept_obj, dumpl, dumps, loads, get_insts
from util import cls_obj, schd_obj, get_courses
class courses:
def GET(self):
objs = web.ctx.orm.query(models.Course).all()
return dumpl(objs)
class CourseDept:
View gist:612218
import Data.Heap as H
import Data.Heap (viewHead,insert)
import Prelude hiding (id)
import Control.Monad.ST (runST)
import Data.STRef (newSTRef,readSTRef,modifySTRef)
import Data.IntSet (IntSet,singleton,empty,fromList)
import Data.List (elem,delete)
type Vertex = Int
type Weight = Int
View message_test.rb
# imports via http://www.slideshare.net/pauldix/building-web-service-clients-with-activemodel
require 'rubygems'
require 'active_model'
require 'test/unit'
require File.expand_path('../../../app/models/message', __FILE__)
class MessageTest < ActiveModel::TestCase
include ActiveModel::Lint::Tests
# Replace this with your real tests.
View gist:703113
can [:create, :update, :destroy], Foo do |foo|
habit.user == user
end
View gist:708460
$ rspec spec/
No examples were matched. Perhaps {:if=>#<Proc:0x93878c8@/home/blt/.rvm/gems/ruby-1.9.2-p0@mentorapp/gems/rspec-core-2.1.0/lib/rspec/core/configuration.rb:52 (lambda)>, :unless=>#<Proc:0x9384bb4@/home/blt/.rvm/gems/ruby-1.9.2-p0@mentorapp/gems/rspec-core-2.1.0/lib/rspec/core/configuration.rb:53 (lambda)>} is excluding everything?
Finished in 0.00003 seconds
0 examples, 0 failures
@blt
blt / paths.rb
Created Nov 24, 2010
Machine generated; definitely included.
View paths.rb
$ rake cucumber
(in /home/blt/Documents/projects/rails3apps/cobbler_shoes)
bundle exec /home/blt/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -I "/home/blt/.rvm/gems/ruby-1.9.2-p0@mentorapp/gems/cucumber-0.9.4/lib:lib" "/home/blt/.rvm/gems/ruby-1.9.2-p0@mentorapp/gems/cucumber-0.9.4/bin/cucumber" --profile default
Using the default profile...
U--------------------
(::) failed steps (::)
AbstractController::ActionNotFound (AbstractController::ActionNotFound)
<internal:prelude>:10:in `synchronize'
@blt
blt / mongrel2.conf
Created Dec 7, 2010
Layout of mongrel2 demo up to Manual section 4.5 and steps taken.
View mongrel2.conf
web_app_proxy = Proxy(addr='127.0.0.1', port=80)
chat_demo_dir = Dir(base='examples/chat/static/',
index_file='index.html',
default_ctype='text/plain')
chat_demo = Handler(send_spec='tcp://127.0.0.1:9999',
send_ident='54c6755b-9628-40a4-9a2d-cc82a816345e',
recv_spec='tcp://127.0.0.1:9998', recv_ident='')
You can’t perform that action at this time.