Skip to content

Instantly share code, notes, and snippets.

View felixyz's full-sized avatar

Felix Holmgren felixyz

View GitHub Profile
@felixyz
felixyz / gist:872d0567e0d58d6e6aac
Created March 16, 2015 16:06
dokku nginx config http + https
server {
listen [::]:80;
listen 80;
server_name $NOSSL_SERVER_NAME;
location / {
proxy_pass http://$APP;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host \$http_host;
```
commit
[#world tick: 0]
[#time #system/timer resolution: 1000]
[#thing value: 1 delta: 1]
```
Update
~~~
search
@felixyz
felixyz / converter.rb
Last active January 29, 2025 08:53
dry-validation form => json schema
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
@felixyz
felixyz / impuzzable.pi
Created November 26, 2017 21:24
Impuzzable in Picat
% Impuzzable
% https://nrich.maths.org/1388
import cp.
import util.
main =>
puzzle(Pieces),
time2(Arrangements = find_all_arrangements(Pieces)),
@felixyz
felixyz / gist:329cdecebbd73d001005cdf530877cb5
Created May 20, 2018 21:49
pakcs-2.0.1 install failure log (OS X)
/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
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