Skip to content

Instantly share code, notes, and snippets.

View splattael's full-sized avatar
🏠
Working from home

Peter Leitzen splattael

🏠
Working from home
View GitHub Profile
@spalladino
spalladino / Makefile
Created November 23, 2016 15:40
Proof of concept of Ruby extension written in Crystal
testruby.bundle: testruby.cr
crystal testruby.cr --link-flags "-dynamic -bundle -Wl,-undefined,dynamic_lookup" -o testruby.bundle
irb: testruby.bundle
irb -rtestruby -I.
clean:
rm -rf .crystal testruby.bundle
require 'rom-sql'
setup = ROM.setup('postgres://localhost/rom')
setup.default.adapter.connection.drop_table?(:users)
setup.default.adapter.connection.drop_table?(:groups)
setup.default.adapter.connection.create_table :groups do
Integer :id
String :name, null: false
@kphilipp
kphilipp / match_orb.py
Created November 1, 2013 20:17
demo for orb descriptor matching with opencv
# further information:
# * http://stackoverflow.com/questions/11114349/how-to-visualize-descriptor-matching-using-opencv-module-in-python
# * http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography
# * http://stackoverflow.com/questions/9539473/opencv-orb-not-finding-matches-once-rotation-scale-invariances-are-introduced
# * OpenCV 2 Computer Vision Application Programming Cookbook, Chapter 9
import cv2
import scipy as sp
import numpy as np
@mbj
mbj / names.txt
Last active December 17, 2015 11:09
DM2 names We need a name to solve dm1 and dm2 namespace clash proactively
* rom (ruby-object-mapper)
* rohm
* rome (easier to pronounce)
* resistance
* bloom
* allure
* agrabla (esperanto) agreeable, enjoyable, lovely, nice, pleasant
* vigor (power, energy)
* moxie (courage)
* "mowr" (pronounced "mower", meaning nothing i can think of, except: "mapping objects with ruby")
class CreateUser < Context
def initialize(attributes)
@attributes = attributes
end
def self.call(*args)
new(*args).tap(&:call)
end
def callback(*args)
@wojtekmach
wojtekmach / account_test.rb
Created May 3, 2012 09:45
Writing MiniTest extensions
require 'minitest/autorun'
module MiniTest::Assertions
def assert_changes(obj, method, exp_diff)
before = obj.send method
yield
after = obj.send method
diff = after - before
assert_equal exp_diff, diff, "Expected #{obj.class.name}##{method} to change by #{exp_diff}, changed by #{diff}"
@holderbaum
holderbaum / vzquota.sh
Created June 21, 2011 16:11
Little helper-script for openvz-diskquota management
#!/bin/sh
if [ $# -eq 1 ]
then
VEID=$1
echo -n "space...: "
USAGE=$(grep -A2 "103" /proc/vz/vzquota|sed -n '2,2p'|awk '{print $2}')
SOFTLIMIT=$(grep -A2 "103" /proc/vz/vzquota|sed -n '2,2p'|awk '{print $3}')
HARDLIMIT=$(grep -A2 "103" /proc/vz/vzquota|sed -n '2,2p'|awk '{print $4}')
RUBY_HEAP_MIN_SLOTS=500000
RUBY_HEAP_SLOTS_INCREMENT=250000
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
RUBY_GC_MALLOC_LIMIT=50000000
@bryanl
bryanl / 37singals REE GC environment
Created October 27, 2010 15:54
37signals ree settings
RUBY_HEAP_MIN_SLOTS=600000
RUBY_GC_MALLOC_LIMIT=59000000
RUBY_HEAP_FREE_MIN=100000