Skip to content

Instantly share code, notes, and snippets.

@niwo
niwo / 1. page_load_to_librato.sh
Last active August 29, 2015 14:00
Send page load time to librato
#!/bin/bash
: ${LIBRATO_EMAIL:?"Need to set LIBRATO_EMAIL"}
: ${LIBRATO_TOKEN:?"Need to set LIBRATO_TOKEN"}
LIBRATO_CREDS="$LIBRATO_EMAIL:$LIBRATO_TOKEN"
LIBRATO_URL="https://metrics-api.librato.com/v1/metrics"
PAGE=$1
SENSOR=${2:-$HOSTNAME}
@niwo
niwo / rbenv.sh
Created January 30, 2013 11:12
Global rbenv setup: enable for every user per default /etc/profile.d/rbenv.sh
# but this at /etc/profile.d/rbenv.sh
# rbenv setup - only add RBENV PATH variables if no single user install found
if [[ ! -d "${HOME}/.rbenv" ]]; then
export RBENV_ROOT=/opt/rbenv
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"
fi
@niwo
niwo / puma
Last active May 31, 2024 14:19
puma with rbenv on CentOS 6
#!/bin/sh
#
# puma - this script starts and stops the puma daemon
#
# chkconfig: - 85 15
# description: Description \
# goes here...
# processname: puma
# config: /etc/puma.conf
# pidfile: /home/stanislaw/apps/micro-apps/puma/puma.pid
@niwo
niwo / rpcm.conf
Created November 22, 2011 10:02 — forked from mguterl/gist:308216
Unicorn init.d script (chkconfig compatible) /etc/init.d/unicorn with example application configuration scripts
# starts all unicorns listed in /etc/unicorn/*.conf
# lives under /etc/unicorn/rpcm.conf
ENV=production
APP_ROOT=/opt/rpcm
@niwo
niwo / dlspeed.rb
Created July 21, 2011 13:27
Measure http download speed including partial requests
#!/usr/bin/env ruby
# dlspeed.rb - niwo 2011
# test speed of http downloads: partial (tail, head) and full download
# Output is csv to stdout
#################################################
require 'optparse'
@niwo
niwo / chromium_updater.rb
Created July 18, 2011 21:17 — forked from newtonapple/chromium_updater.rb
An automated Ruby script for grabbing the latest Mac Chromium build
#!/usr/bin/env ruby
# A simple Ruby script to update Chromium from dev build.
# Currently only works on Mac and Win32.
# If you want progress bar, sudo gem install ruby-progressbar
# Read more about progress bar here: http://github.com/nex3/ruby-progressbar/tree/master
# Usage:
# ruby chromium_updater.rb
require 'fileutils'
@niwo
niwo / svn_autocommit.sh
Created March 25, 2011 11:23
Bash script for auto-committing from a SVN working copy
#!/bin/bash
### Settings
svn_wk='/srv/tftp/data/'
svn_user='user'
svn_passwd='passwd'
### Variables
date=`date +"%F %T"`
svn='/usr/bin/svn'