The server.rb
file slowly feeds data to the socket, and both clients will yield data as it's available. UneventfulMachine
steals the API of EventMachine.
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
#!/usr/bin/env python3 | |
# Copyright (c) 2014 Joergen Ibsen | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a | |
# copy of this software and associated documentation files (the "Software"), | |
# to deal in the Software without restriction, including without limitation | |
# the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
# and/or sell copies of the Software, and to permit persons to whom the | |
# Software is furnished to do so, subject to the following conditions: |
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
" markdown.vim | |
" Markdown preview using RDiscount ruby gem. | |
" Put this file into .vim/ftplugin | |
command! -nargs=0 MarkdownPreview call MarkdownRenderBufferToPreview() | |
noremap <buffer> <Leader>rp :MarkdownPreview<CR> | |
setlocal ignorecase | |
setlocal wrap |
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
#!/bin/bash | |
# Junegunn Choi (junegunn.c@gmail.com) | |
# 2011/09/02- | |
# init.d-style daemon script for JRuby with spoon gem. | |
APP_NAME=sleeper | |
APP_PATH=/Users/jg/github/jruby-daemon/sleeper.rb | |
JRUBY=/Users/jg/.rvm/rubies/jruby-1.6.4/bin/ruby |
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
(defun format-color (rgb) | |
"Convert a triplet of floating point (0.0-1.0) RGB values into | |
a hex triplet" | |
(apply 'format "#%02x%02x%02x" | |
(mapcar (lambda (x) (* 255 x)) rgb))) | |
(defconst colour-triplet-regex | |
"\\([0-9A-Fa-f]\\{2\\}\\)\\([0-9A-Fa-f]\\{2\\}\\)\\([0-9A-Fa-f]\\{2\\}\\)") |
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
module Query | |
class Expression | |
attr_reader :field, :operator, :target | |
def initialize(field, operator, target) | |
@field, @operator, @target = field, operator, target | |
end | |
end |
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
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
Read 4K randomly from SSD* 150,000 ns 0.15 ms |
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
; Released under the Apache License, Version 2.0 | |
; http://www.apache.org/licenses/LICENSE-2.0.html | |
(defmacro try-let | |
"A combination of try and let such that exceptions thrown in the binding or | |
body can be handled by catch clauses in the body, and all bindings are | |
available to the catch and finally clauses. If an exception is thrown while | |
evaluating a binding value, it and all subsequent binding values will be nil. | |
Example: |
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
#!/usr/bin/env jruby | |
# | |
# | |
require 'rubygems' | |
require 'spoon' | |
EXEC = '/tmp/exec.rb' | |
PID_PATH = '/tmp/exec.pid' | |
WORK_PATH = '/tmp/' |
OlderNewer