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 |
| require "bmg" | |
| require "benchmark" | |
| a_domain = (0..10_000).to_a | |
| b_domain = %w[a b c d e f g h i j k l m n o p q] | |
| puts "Generate relations..." | |
| rels = (0..1_000).map do |n| | |
| n_tuples = n == 0 ? 100_000 : 100 |
| /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 |