Skip to content

Instantly share code, notes, and snippets.

View felixbuenemann's full-sized avatar
💭
I may be slow to respond.

Felix Bünemann felixbuenemann

💭
I may be slow to respond.
View GitHub Profile
#!/bin/sh
# Script to compile vips from git for AWS lambda as dynamic binary
# Run on a fresh amzn-ami-hvm-2015.09.1.x86_64-gp2 image.
# Tested with image id ami-bff32ccc on t2.micro in eu-west-1.
set -e # abort on errors
# set -x # for debugging
echo Installing build dependencies...
// AWS Lamda Function to Test Dynamic VIPS Binary
var exec = require('child_process').exec;
var spawn = require('child_process').spawn;
var https = require('https');
// Example Event:
// {
// "cmd": "/tmp/vips/bin/vips -v",
// "url": "https://www.dropbox.com/s/nba1piz7wfx2wb0/vips-8.3.0-0a4991c-dynamic.tar.bz2?dl=1"
// }
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
# gem 'activerecord', '5.0.0.beta2'

Ruby VIPS Benchmark with different GC strategies

ruby:

ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]

test:

[ 2016-01-09 23:07:49.9050 3004/7f524af057c0 age/Cor/CoreMain.cpp:794 ]: Disconnecting long-running connections for process 3099, application app
[ 2016-01-09 23:07:50.1082 3004/7f524af057c0 age/Cor/CoreMain.cpp:942 ]: Passenger core shutdown finished
[ 2016-01-09 23:07:50.9311 4370/7fa4e787e7c0 age/Wat/WatchdogMain.cpp:1276 ]: Starting Passenger watchdog...
[ 2016-01-09 23:07:50.9378 4373/7f47a3ec07c0 age/Cor/CoreMain.cpp:957 ]: Starting Passenger core...
[ 2016-01-09 23:07:50.9380 4373/7f47a3ec07c0 age/Cor/CoreMain.cpp:234 ]: Passenger core running in multi-application mode.
[ 2016-01-09 23:07:50.9401 4373/7f47a3ec07c0 age/Cor/CoreMain.cpp:707 ]: Passenger core online, PID 4373
[ 2016-01-09 23:07:50.9495 4378/7f213d73f7c0 age/Ust/UstRouterMain.cpp:504 ]: Starting Passenger UstRouter...
[ 2016-01-09 23:07:50.9501 4378/7f213d73f7c0 age/Ust/UstRouterMain.cpp:317 ]: Passenger UstRouter online, PID 4378
App 4402 stdout:
App 4484 stdout:
@felixbuenemann
felixbuenemann / em-108-arm-kqueue-writer-failed-testcase.rb
Last active August 28, 2015 23:50
Testcase to reproduce kqueue crash with thin on eventmachine 1.0.8
#!/usr/bin/env ruby
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
@felixbuenemann
felixbuenemann / ghc.rb
Last active April 21, 2021 23:54
Homebrew formula for official ghc 7.10.2 binaries
class Ghc < Formula
desc "Glorious Glasgow Haskell Compilation System"
homepage "https://haskell.org/ghc/"
url "https://downloads.haskell.org/~ghc/7.10.2/ghc-7.10.2-x86_64-apple-darwin.tar.xz"
sha256 "ef0f00885096e3621cec84a112dfae050cf546ad39bdef29a7719407c6bc5b36"
def install
system "./configure", "--prefix=#{prefix}"
ENV.deparallelize { system "make", "install" }
@felixbuenemann
felixbuenemann / base58uid.js
Last active September 11, 2023 13:53
Generate random 10 byte base58 identifiers
var min = 7427658739644928; // min int value that is 10 bytes long in base58
var max = 9007199254740992; // max safe integer (exclusive), also 10 bytes
var alphabet = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'; // base58
var base = alphabet.length;
function encode(num) {
var mod, str = '';
while (num >= base) {
mod = num % base;
@felixbuenemann
felixbuenemann / varnish4-newrelic-x-request-start.vcl
Last active February 2, 2017 10:44
Varnish 4 X-Request-Start Header for New Relic Queue Time Reporting
# To allow inline-C in VCL start varnishd with -p vcc_allow_inline_c=on
C{
#include <sys/time.h>
#include <stdio.h>
static const struct gethdr_s VGC_HDR_REQ_reqstart = { HDR_REQ, "\020X-Request-Start:" };
}C
sub vcl_recv {
# Add X-Request-Start header for New Relic queue time analytics
C{
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
# Activate the gem you are reporting the issue against.