Go's concurrency model on top of JRuby
Channel.new
creates a channel, and you can optionally pass it a capacity: Channel.new(200)
Use <<
to send on a channel: chan << "stuff"
<!doctype html> | |
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ --> | |
<html> | |
<head> | |
<title>iOS 8 web app</title> | |
<!-- CONFIGURATION --> |
set :rails_env, :production | |
set :unicorn_binary, "/usr/bin/unicorn" | |
set :unicorn_config, "#{current_path}/config/unicorn.rb" | |
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
namespace :deploy do | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D" | |
end | |
task :stop, :roles => :app, :except => { :no_release => true } do |
#!/bin/bash | |
# --- Version history --- | |
# 0.4: added variable to store file path, and $2 for base file name | |
# added variable to store desired reporting interval | |
# 0.3: added $1 to send in process ID at run time. | |
# 0.2: switched to $SECONDS for the loop. works. | |
# 0.1: didn't work well at all. | |
# --- Version history --- | |
# Usage: cputrack [PID] [filename] |
[jgalang@rashomon:~/Code/skunkworks/2fa] | |
∴ ruby totp_demo.rb | |
Time(sec) Time (UTC format) Value of T(Hex) TOTP Mode OK | |
------------------------------------------------------------------------------------------ | |
59 1970-01-01 00:00:59 0000000000000001 94287082 SHA1 ✔ | |
59 1970-01-01 00:00:59 0000000000000001 46119246 SHA256 ✔ | |
59 1970-01-01 00:00:59 0000000000000001 90693936 SHA512 ✔ | |
1111111109 2005-03-18 01:58:29 00000000023523EC 07081804 SHA1 ✔ | |
1111111109 2005-03-18 01:58:29 00000000023523EC 68084774 SHA256 ✔ |
# /config.ru | |
# This file is used by Rack-based servers to start the application. | |
# For Rails | |
require ::File.expand_path('../config/environment', __FILE__) | |
# For Sinatra | |
require './slim/slim.rb' | |
# - Make sinatra play nice | |
use Rack::MethodOverride |
I build companies + products + high performing teams. I get results. Sometimes I advise startups.
{ | |
"love": 11.666666666666666, | |
"music": 8.333333333333332, | |
"design": 8.333333333333332, | |
"social": 6.666666666666667, | |
"creator": 6.666666666666667, | |
"estate": 5, | |
"entrepreneur": 5, | |
"engineer": 5, | |
"web": 5, |
Some stuff that makes me happy:
#!/bin/sh | |
# Generate n random numbers in [0, 999]. n defaults to 100 but override it with $1. | |
if [ "$1" == '' ]; then | |
upto=100 | |
else | |
upto=$1 | |
fi | |
for i in `seq 1 $upto`; do echo $(($RANDOM % 1000)); done |