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
$vm = CameronSpaces::VM.new("../../hydra-vm.git").load | |
$vm.users["lian"]["macbook"].connect | |
$vm.spaces["hydra"].attach_session $vm.users["lian"]["macbook"] | |
$vm.spaces["hydra"].add_object WorkspaceObject::CoreVideo.new "video_test" | |
$vm.spaces["hydra"]["video_test"].load_movie "testmovie.mp4", :autostart => true | |
250.times do | |
sleep 0.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
http://vimeo.com/3324904 => | |
http://www.vimeo.com/moogaloop/load/clip:3324904 => | |
<request_signature>2bc05a3a2f36cd94be799f52c5f09e3a</request_signature> | |
<request_signature_expires>1239724800</request_signature_expires> | |
=> flashvideo link: http://www.vimeo.com/moogaloop/play/clip:3324904/2bc05a3a2f36cd94be799f52c5f09e3a/1239724800/?q=sd |
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
// $ curl http://localhost:8090/hello/world | |
{ | |
"hello" : "world!", | |
"log" : "BackgroundColor changed, wohooo!" | |
} | |
//== API Syntax Choices | |
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/env ruby | |
# http://sohowww.nascom.nasa.gov/data/realtime/mpeg/ | |
SOHO_URL = "http://sohowww.nascom.nasa.gov/data/LATEST/%s" | |
MPLAYER_CMD = 'mplayer -ao null -really-quiet -geometry %ix%i+%i+%i %s -loop %i -speed %s &' | |
SOHO_ETI = { | |
'ETI_171' => { filename: 'current_eit_171small.mpg' }, | |
#'ETI_195' => { filename: 'current_eit_195small.mpg' }, | |
'ETI_284' => { filename: 'current_eit_284small.mpg' }, | |
'ETI_304' => { filename: 'current_eit_304small.mpg' }, |
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
require 'socket' | |
# ..old method found in my teeworlds-svn dir | |
def query_teeworlds_server(ip="localhost",port="8303") | |
s = UDPSocket.new; s.bind("0.0.0.0", 8304) | |
s.send("\xff\xff\xff\xff\xff\xff\xff\xff\xff\xffgief", 0, ip, port); sleep 0.2 | |
response = s.recvfrom_nonblock(1024); s.close | |
ar = response[0][20..-1].split "\000" | |
player = ar[7..-1] | |
players = {} |
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
# SEE: https://github.com/lian/ffi-flite | |
require 'ffi' | |
module FFI::Flite | |
extend FFI::Library | |
ffi_lib_flags(:lazy, :global) | |
ffi_lib [ 'smixer-sbase', '/usr/lib/alsa-lib/smixer/smixer-sbase.so'], [ 'flite' ] | |
attach_function :init, :flite_init, [], :int |
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
require 'ffi-tk' | |
require 'bacon' | |
Tk.init | |
b = lambda { | |
describe 'Tk.root.tk_inactive' do | |
it 'resets' do | |
inactive = Tk.root.tk_inactive | |
inactive.should > 0 |
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
# stripped cvHaarDetectObjects version of ffi-opencv | |
# % pacman -S opencv (tested/updated for 2.3.1) | |
# % ruby ffi-facedetect.rb some.png | |
require 'ffi' | |
module OpenCv | |
extend FFI::Library | |
ffi_lib 'opencv_objdetect' |
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
# lookup coords by name or mac address via google.. (evented) | |
require 'cgi' | |
require 'json' | |
require 'eventmachine' | |
module Goog | |
module Location | |
class Name < EM::Connection | |
Head = <<-TEXT |
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
# % ruby scrot.rb /tmp/screenshot.png | |
# scrot.rb uses xlib + imlib via ffi to capture screenshots. | |
require 'ffi' | |
module X11 | |
extend FFI::Library | |
ffi_lib 'X11' | |
attach_function :XOpenDisplay, [:string], :pointer | |
attach_function :XFlush, [:pointer], :pointer |
OlderNewer