Skip to content

Instantly share code, notes, and snippets.

set daemon 120
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set mailserver localhost
set mail-format { from: monit-noreply@viget.com }
#!/bin/bash
branch=`git status | head -n1 | cut -d' ' -f4`
rake cruise && git checkout master && git merge $branch && rake cruise && git push
rvm install 1.9.3-p194 --with-gcc=clang
Fixes this error In Mac:
```
In file included from ./include/ruby/ruby.h:64,
from ./include/ruby.h:32,
from main.c:13:
/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
@seanami
seanami / sinatra_erb_block_helper_test.rb
Created July 28, 2010 23:24
If you're using Sinatra with ERB and you want to write helpers that take blocks, you need a little bit of magic that other more complex frameworks provide for you (capture). Here's a really really simple example.
require 'rubygems'
require 'sinatra'
require 'erb'
helpers do
def buffer()
@_out_buf
end
def capture(buffer)
pos = buffer.size
@reagent
reagent / whitespace.sh
Last active August 15, 2019 03:27
Convert whitespace from tabs to 2 spaces
#!/bin/bash
set -e # fail on nonzero status
cd $1
files=`find . \
-not \( -path ./vendor -prune \) \
-not \( -path ./tmp -prune \) \
-name '*.html' -o -name '*.js' -o -name '*.coffee' -o \
This example shows how to setup an environment running Rails 3 under 1.9.2 with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell)) or do 'rvm reload'
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.2
# Switch to 1.9.2-head and gemset rails3, create if it doesn't exist.
∴ rvm --create use 1.9.2@rails3
@flomotlik
flomotlik / myapp.rb
Created February 24, 2012 13:51
Using Thor subcommands
require 'thor'
require "sub"
class MyApp < Thor
desc "parentcommand SUBCOMMAND", "Some Parent Command"
subcommand "sub", Sub
end
MyApp.start
@sergeyklay
sergeyklay / phpenv-install.md
Last active March 3, 2024 10:45
Multiple PHP versions using phpenv and php-build

Multiple PHP versions using phpenv and php-build

Install dependecies

Debian/Ubuntu users

sudo apt install \
  autoconf \
  bison \
@enricofoltran
enricofoltran / main.go
Last active April 1, 2024 00:17
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@rkumar
rkumar / gist:445735
Created June 20, 2010 10:47
ruby's OptionParser to get subcommands
#!/usr/bin/env ruby -w
## Using ruby's standard OptionParser to get subcommand's in command line arguments
## Note you cannot do: opt.rb help command
## other options are commander, main, GLI, trollop...
# run it as
# ruby opt.rb --help
# ruby opt.rb foo --help
# ruby opt.rb foo -q
# etc