Skip to content

Instantly share code, notes, and snippets.

$ModLoad imfile
$inputFileName /srv/nginx/log/<VHOST_NAME>.access.log
$inputFileTag <VHOST_NAME>_info:
$InputFileStateFile <VHOST_NAME>_info_state
$InputFileSeverity info
$InputFileFacility local7
$InputRunFileMonitor
*.* @@<REMOTE SYSLOG IP>:514
-- Thu Aug 29 20:25:10 PDT 2013 - Ruby Version: 1.9.3-p374 - ------------------------------------------------------------------------------------------------------------------------------------------------------- /Users/paul --
-- paul@Pauls-MacBook-Pro $ telnet binary-yoga.com 80
Trying 50.63.202.31...
Connected to binary-yoga.com.
Escape character is '^]'.
GET / HTTP/1.1
host: binary-yoga.com
HTTP/1.1 200 OK
Cache-Control: max-age=900
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'optparse'
require 'net/http'
require 'highline/import'
opts = Hash.new
#!/usr/bin/env ruby
require 'date'
require 'syslog'
require 'fileutils'
bkup_dir = ARGV.first
log = Syslog.open($0, Syslog::LOG_PID | Syslog::LOG_CONS)
log.info "Starting backup rotation for #{bkup_dir}"
########## Syslog priorities ##########
CRIT="user.crit"
ERROR="user.err"
WARN="user.warn"
NOTICE="user.notice"
INFO="user.info"
DEBUG="user.debug"
#######################################
debug(){
@paulmooring
paulmooring / pg_backup.sh
Last active December 19, 2015 09:49
backup script for postgresql
#!/usr/bin/env bash
# Author:: Paul Mooring (<[email protected]>)
# Copyright:: Copyright (c) 2013 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@paulmooring
paulmooring / ruby_args.rb
Created June 4, 2013 18:02
Ruby arguments
# Function with 2 arguments and no default values
[1] pry(main)> def test(one, two)
[1] pry(main)* puts one
[1] pry(main)* puts two
[1] pry(main)* end
# Function with 2 arguments has a default value on 2
[2] pry(main)> def test2(one, two="world!")
[2] pry(main)* puts one
[2] pry(main)* puts two
[3] pry(main)> f = File.open("/tmp/lol", "w")
=> #<File:/tmp/lol>
[4] pry(main)> f.flock(File::LOCK_EX)
=> 0
[5] pry(main)> g = File.open("/tmp/lol", "w")
=> #<File:/tmp/lol>
[6] pry(main)> g.flock(File::LOCK_EX)
### Hangs 4-eva ###
* service[postgresql] action nothing (up to date)
* execute[/opt/opscode/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef] action run
================================================================================
Error executing action `run` on resource 'execute[/opt/opscode/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
@paulmooring
paulmooring / knife memory usage
Created February 26, 2013 15:46
knife memory usage
[pmooring@jenkins ~]$ valgrind --tool=massif --depth=1 --trace-children=yes knife -v && ms_print massif.out*
==16710== Massif, a heap profiler
==16710== Copyright (C) 2003-2010, and GNU GPL'd, by Nicholas Nethercote
==16710== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==16710== Command: /usr/bin/knife -v
==16710==
Chef: 11.2.0
==16710==
--------------------------------------------------------------------------------
Command: /usr/bin/knife -v