Skip to content

Instantly share code, notes, and snippets.

View erlingwl's full-sized avatar

Erling Wegger Linde erlingwl

View GitHub Profile
# Remove old data
curl -XDELETE "http://localhost:9200/grandissue"
# Create index with defaults
curl -XPOST "http://localhost:9200/grandissue" -d '{
"settings": {
"index": {
"number_of_shards": 4,
"number_of_replicas": 1
}
@erlingwl
erlingwl / gist:5386985
Last active December 16, 2015 05:49 — forked from pkordel/gist:5386788
# -*- encoding : utf-8 -*-
require 'unit_spec_helper'
require 'ostruct'
describe "Parser" do
let(:expected) {
[
["(0) Mammal", 1],
["(0) Mammal | (0) Dog", 3],
@erlingwl
erlingwl / gist:3792714
Created September 27, 2012 07:39
Ubuntu, Ruby 1.9.3, Rails 3.2.x installation troubleshooting
Installing ruby:
curl -L https://get.rvm.io | bash -s stable --ruby
Installing rails:
gem install rails
Creating a new rails project:
@erlingwl
erlingwl / postgis.rb
Created May 22, 2012 11:08
Postgis 1.5.1 Homebrew
require 'formula'
def build_gui?
ARGV.include? '--with-gui'
end
class Postgis < Formula
homepage 'http://postgis.refractions.net'
url 'http://postgis.org/download/postgis-1.5.1.tar.gz'
md5 '8353b38c38282b2192f01693f71b8d28'
@erlingwl
erlingwl / postgresql.rb
Created May 22, 2012 11:01
Postgres 8.4.11 Homebrew forumula
require 'formula'
require 'hardware'
class Postgresql <Formula
homepage 'http://www.postgresql.org/'
url 'http://ftp2.uk.postgresql.org/sites/ftp.postgresql.org/source/v8.4.11/postgresql-8.4.11.tar.bz2'
md5 'f9b731a1162b177a173640efab2275d0'
depends_on 'readline'
depends_on 'libxml2' if MACOS_VERSION < 10.6 # Leopard libxml is too old
@erlingwl
erlingwl / default.rb
Created April 19, 2012 20:48
cookbooks/munin/attributes/default.rb
default['munin']['sysadmin_email'] = "your@email.com"
default['munin']['server_role'] = 'muninserver'
default['munin']['server_auth_method'] = 'htauth'
@erlingwl
erlingwl / muninserver.rb
Created April 19, 2012 20:05
Munin server role chef
name "muninserver"
description "Munin server"
run_list(
"recipe[chef-client]",
"recipe[munin::server]"
)
default_attributes(
)
@erlingwl
erlingwl / production.rb
Created April 19, 2012 20:01
environments/production.rb
name "production"
description "Nodes in production"
@erlingwl
erlingwl / end_of_default.rb
Created April 19, 2012 19:01
monitrc from cookbooks/ngninx/recipes/default.rb
monitrc("nginx-monit") \
if node.recipes.include?('monit')
@erlingwl
erlingwl / nginx-monit.conf.erb
Created April 19, 2012 18:59
Ngninx monit config
# nginx
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
if failed host 127.0.0.1 port 80 then restart
if cpu is greater than 40% for 2 cycles then alert