Skip to content

Instantly share code, notes, and snippets.

View bigtunacan's full-sized avatar

Joiey Seeley bigtunacan

  • The University of Iowa
View GitHub Profile
@bigtunacan
bigtunacan / onehundredpoint.txt
Last active April 22, 2021 01:24
Cognoa Word Calculator
abactinally
abrogative
absinthol
acclimation
accumulate
acenaphthene
achroous
acknowledge
acriflavine
acromegaly
loop do
pid = fork do
puts 'foo'
exit 99
end
#ret_pid = waitpid(pid) # Tried this, but it blocks
ret_pid = wait2(pid, Process::WNOHANG) # Tried this, but it never gets a value
if ret_pid
puts 'got a returned pid'
@bigtunacan
bigtunacan / gosu-tk.rb
Created September 1, 2015 03:32
Show Gosu and Tk running side by side so we can add tradition UI along with Gosu apps.
require 'gosu'
require 'tk'
class GameWindow < Gosu::Window
def initialize
super 640, 480
self.caption = "Gosu Tutorial Game"
@frog = Gosu::Image.new("./frog_cling_1.png")
@x = 0
def wait_for_ajax
max_ajax_wait = 60
time_limit, interval = (Time.now + max_ajax_wait), 0.5
loop do
break if page.evaluate_script("(typeof(jQuery) !== 'undefined' && jQuery.active === 0)")
sleep interval
fail "Wait for AJAX timed out after waiting for #{max_ajax_wait} seconds" if Time.now > time_limit
end
end
require 'artoo'
connection :sphero, :adaptor => :sphero, :port => '/dev/tty.Sphero-YBB-AMP-SPP'
device :sphero, :driver => :sphero
connection :keyboard, adaptor: :keyboard
device :keyboard, driver: :keyboard, connection: :keyboard
def keypress(sender, key)
case key
@bigtunacan
bigtunacan / artoo_sphero_api.rb
Last active August 29, 2015 14:16
Artoo Sphero Access through API
require 'artoo'
#connection :loop
#device :passthru
connection :sphero, :adaptor => :sphero, :port => '/dev/tty.Sphero-YBB-AMP-SPP'
device :sphero, :driver => :sphero
api :host => '127.0.0.1', :port => '4321'
@bigtunacan
bigtunacan / sinatra_array_routes
Created October 10, 2014 15:43
Basic sample showing how routes could be created by enumerating over an array.
require 'sinatra'
enable :sessions
$foo = ['foo', 'bar']
$foo.each do |vi|
get '/' + vi do
erb :hello
end
@bigtunacan
bigtunacan / cylon-joystick error
Created October 10, 2014 07:02
After installing all SDL dependencies still getting errors from cylon-joystick on the Beaglebone Black
root@beaglebone:~/code/cylon# node main.js
I, [2014-10-10T07:01:35.775Z] INFO -- : Initializing connections.
I, [2014-10-10T07:01:35.798Z] INFO -- : Initializing connection 'joystick'.
D, [2014-10-10T07:01:35.805Z] DEBUG -- : Loading adaptor 'joystick'.
Error: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
require "peach"
mutex = Mutex.new
t=(1..500000).map{ rand};
a=0;
t2=t.pmap(4) do |z|
mutex.lock
a+=1;
mutex.unlock
@bigtunacan
bigtunacan / tmux_session
Created April 14, 2014 16:39
tmux session script
#!/bin/bash
cd ~/code/eiacuc
tmux has-session -t eiacuc
if [ $? != 0 ]
then
tmux new -s eiacuc -n vim -d
tmux send-keys -t eiacuc 'vim' C-m
tmux split-window -v -p 20 -t eiacuc
tmux send-keys -t eiacuc:0.1 'cd ~/code/eiacuc' C-m
tmux new-window -n server -t eiacuc