Teh Social Netswork!
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR(10) NOT NULL
);
INSERT into users VALUES
Teh Social Netswork!
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR(10) NOT NULL
);
INSERT into users VALUES
module DryJsonSchema | |
# Transforms a dry-validation form to json-schema-compatible objects (hash or array) | |
# Usage: | |
# DryJsonSchema::Converter.(my_form) | |
# => { :type => :object, | |
# :properties => { :abc => { :type => :integer }, | |
# :xyz => { :type => :integer } | |
# }, | |
# :required => [:abc]} | |
class Converter |
/Applications/Xcode.app/Contents/Developer/usr/bin/make config 2>&1 | tee -a make.log | |
cd scripts && /Applications/Xcode.app/Contents/Developer/usr/bin/make all | |
/Applications/Xcode.app/Contents/Developer/usr/bin/make /Users/felix/code/pakcs-2.0.1/bin/pakcs /Users/felix/code/pakcs-2.0.1/bin/pakcs-makecgi /Users/felix/code/pakcs-2.0.1/bin/cleancurry /Users/felix/code/pakcs-2.0.1/bin/pakcs-fcypp | |
mkdir -p /Users/felix/code/pakcs-2.0.1/bin | |
cat pakcs.sh | sed "s|^PAKCSBUILDDIR=.*$|PAKCSBUILDDIR=/Users/felix/code/pakcs-2.0.1|" | \ | |
sed "s|^PAKCSINSTALLDIR=.*$|PAKCSINSTALLDIR=|" > /Users/felix/code/pakcs-2.0.1/bin/pakcs | |
chmod 755 /Users/felix/code/pakcs-2.0.1/bin/pakcs | |
mkdir -p /Users/felix/code/pakcs-2.0.1/bin | |
cat pakcs-makecgi.sh | sed "s|^PAKCSBUILDDIR=.*$|PAKCSBUILDDIR=/Users/felix/code/pakcs-2.0.1|" | \ | |
sed "s|^PAKCSINSTALLDIR=.*$|PAKCSINSTALLDIR=|" > /Users/felix/code/pakcs-2.0.1/bin/pakcs-makecgi |
% Impuzzable | |
% https://nrich.maths.org/1388 | |
import cp. | |
import util. | |
main => | |
puzzle(Pieces), | |
time2(Arrangements = find_all_arrangements(Pieces)), |
``` | |
commit | |
[#world tick: 0] | |
[#time #system/timer resolution: 1000] | |
[#thing value: 1 delta: 1] | |
``` | |
Update | |
~~~ | |
search |
require 'benchmark' | |
def insert_then_sort(results, missing_items) | |
missing_items.each do |id| | |
results << {id: id, val: nil} | |
end | |
results.sort_by!{|item| item[:id] } | |
results | |
end |
# Running on OS X | |
# JRuby + Celluloid = OK | |
# MRI + Celluloid = OK | |
# JRuby + Celluloid::IO = OK | |
# MRI + Celluloid::IO = Too many open files - pipe (Errno::EMFILE) | |
require 'celluloid/io' | |
class SimpleActor | |
# include Celluloid # Creating regular Celluloid actors works on MRI |
wakeups = [] | |
wakers = [] | |
puts "Creating pipes..." | |
200.times do |n| | |
puts "[#{n}]" | |
wakeup, waker = IO.pipe | |
wakeups << wakeup | |
wakers << waker |
require 'thread' | |
require 'celluloid/io' | |
require 'celluloid/redis' | |
KEY = "magic_key" | |
VALUE = {a: 1, b:2} | |
class RedisActor | |
include Celluloid::IO |
require 'thread' | |
def provider() | |
threads = [] | |
queue = Queue.new | |
1.upto(10).each do |n| | |
threads << Thread.new { | |
sleep rand(0.1..2) | |
queue << n | |
} |