Skip to content

Instantly share code, notes, and snippets.

@bbrowning
bbrowning / jubilee
Created January 3, 2014 19:18
jubilee vs torqbox performance on techempower json benchmark after warmup period
# Jubille started with:
# jubilee -p 8080 -e production
#
# Note that the Jubilee console outputs quite a few errors like below during
# the test:
#
# Jan 03, 2014 2:15:31 PM org.vertx.java.core.logging.impl.JULLogDelegate error
# SEVERE: Unhandled exception
# java.nio.channels.ClosedChannelException
@pauloricardomg
pauloricardomg / cors.nginxconf
Last active March 8, 2024 18:31
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
#! /bin/sh
# Base on Gitlab. khairul@bukalapak.com
# GITLAB
# Maintainer: @randx
# Authors: rovanion.luckey@gmail.com, @randx
# App Version: 6.0
### BEGIN INIT INFO
@light9
light9 / run
Last active December 24, 2015 20:09
Use Runit for running NodeJS in Ubuntu as Service better use: http://kvz.io/blog/2009/12/15/run-nodejs-as-a-service-on-ubuntu-karmic/
#!/bin/sh
cd /srv/www/derby/hello-derby
exec 2>&1
exec chpst -U www-data node server.js >> /srv/www/derby/hello-derby/node.log 2>&
@mpasternacki
mpasternacki / docker-compile.pl
Last active March 23, 2020 14:05
Perl script to build a Docker image from Dockerfile that creates the image in a single layer, without any intermediate images. Needs JSON CPAN module (available as `libjson-perl` Debian/Ubuntu package). Usage: run the script in the directory that contains a Dockerfile. More details in a blog post: http://3ofcoins.net/2013/09/22/flat-docker-images/
#!/usr/bin/env perl
use feature 'switch';
use strict;
use warnings;
use Data::Dumper;
use File::Basename;
use File::Copy;
use File::Path qw/make_path/;
@adamico
adamico / collection_check_boxes_input.rb
Last active April 28, 2020 15:12 — forked from mattclar/simple_form.rb
This fork adds a custom horizontal form wrapper and merges append/prepend in a 'group' wrapper
#app/inputs/collection_check_boxes_input.rb
class CollectionCheckBoxesInput < SimpleForm::Inputs::CollectionCheckBoxesInput
def item_wrapper_class
"checkbox-inline"
end
end
% curl -XPOST "localhost:9200/search/vertex/_search?pretty=true" -d '{"query":{"match_all":{}}}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
@thomasritz
thomasritz / memcached.yml.erb
Created August 30, 2013 09:35
custom OpsWorks cookbook memcached.yml.erb that supports memcached cluster
# rails/templates/default/memcached.yml.erb
<%
instances = node[:opsworks][:layers][:memcached][:instances]
instances = {:localhost => {:private_ip => "127.0.0.1"}} if instances.empty?
-%>
hosts:
<% instances.each_pair do |name, cache_server| -%>
- "<%= cache_server[:private_ip]%>:<%= @memcached[:port] %>"
<% end -%>
@benmj
benmj / geocoder-service.js
Created August 29, 2013 16:38
An AngularJS Service for intelligently geocoding addresses using Google's API. Makes use of localStorage (via the ngStorage package) to avoid unnecessary trips to the server. Queries Google's API synchronously to avoid `google.maps.GeocoderStatus.OVER_QUERY_LIMIT`
/*global angular: true, google: true, _ : true */
'use strict';
angular.module('geocoder', ['ngStorage']).factory('Geocoder', function ($localStorage, $q, $timeout) {
var locations = $localStorage.locations ? JSON.parse($localStorage.locations) : {};
var queue = [];
// Amount of time (in milliseconds) to pause between each trip to the