Skip to content

Instantly share code, notes, and snippets.

View trinitronx's full-sized avatar
⛩️
Zazen

James Cuzella trinitronx

⛩️
Zazen
View GitHub Profile
@nkwhr
nkwhr / supervise.rb
Last active August 29, 2015 13:58
a serverspec resource type for checking services running under daemontools.
module Serverspec
module Type
class Supervise < Base
def initialize(name)
@name = name
end
def status
ret = backend.run_command("svstat /service/#{@name} | awk '{print $2}'")
ret[:stdout].chomp
### Rakefile
task :template do
require 'yaml'
require 'erb'
base = File.join(File.dirname(__FILE__), 'config')
source = File.join(base, 'dna.json.erb')
target = File.join(base, 'dna.json')
recipes = ENV['recipe'] || %w(packages users gems)
@kares
kares / .bash_profile
Created December 12, 2010 12:49
$rvm_path upgrade
# 1. update rvm loading in .bash_profile, by default it looks like :
# [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
if [ -s "$HOME/.rvmrc" ]; then
source "$HOME/.rvmrc"
fi # to have $rvm_path defined if set
if [ -s "${rvm_path-$HOME/.rvm}/scripts/rvm" ]; then
source "${rvm_path-$HOME/.rvm}/scripts/rvm"
fi
@timdiggins
timdiggins / chef-roles-to-json-task.rb
Created February 19, 2011 06:53
rake task to convert existing ruby roles to json
# ADD this to Rakefile and run it by issuing rake roles.to_json
ROLE_DIR = File.expand_path(File.join(TOPDIR, "roles"))
namespace :roles do
desc "Convert ruby roles from ruby to json, creating/overwriting json files."
task :to_json do
Dir.glob(File.join(ROLE_DIR, '*.rb')) do |rb_file|
role = Chef::Role.new
role.from_file(rb_file)
json_file = rb_file.sub(/\.rb$/,'.json')
@al3xandru
al3xandru / gist:1156476
Created August 19, 2011 09:48
Open iTerm in Current Folder
on run {input, parameters}
tell application "Finder"
set sel to selection
if (count sel) > 0 then
set myTarget to item 1 of sel
else if (count window) > 0 then
set myTarget to target of window 1
else
set myTarget to path to home folder
end if
@vinitkhandagle
vinitkhandagle / Bootstrap_vagrantvm
Last active December 14, 2015 23:18
Bootstrapping a Newly Installed Vagrant Box
linbynd:=> {master} ~/vagrant_machines$ knife bootstrap 192.168.1.3 -x vagrant -P vagrant --sudo
Bootstrapping Chef on 192.168.1.3
192.168.1.3 --2013-03-14 19:21:32-- http://opscode.com/chef/install.sh
192.168.1.3
192.168.1.3 Resolving opscode.com (opscode.com)...
192.168.1.3 184.106.28.83
192.168.1.3
192.168.1.3 Connecting to opscode.com (opscode.com)|184.106.28.83|:80...
192.168.1.3 connected.
192.168.1.3
@jdutton
jdutton / rsyslog-to-logstash.conf
Created April 2, 2013 19:33
Rsyslog conf file to send rsyslog output to logstash as a native json logstash event. For more info - see blog post at http://untergeek.com/2012/10/11/using-rsyslog-to-send-pre-formatted-json-to-logstash/
# Send a native logstash json event to the logstash server
$template ls_json,"{%timestamp:::date-rfc3339,jsonf:@timestamp%,\"@message\":\"%msg:::json%\",\"@fields\":{%fromhost:::jsonf:host%,%syslogfacility-text:::jsonf:syslog_facility%,%syslogfacility:::jsonf:syslog_facility_code%,%syslogseverity-text:::jsonf:syslog_severity%,%syslogseverity:::jsonf:syslog_severity_code%,%app-name:::jsonf:program%,%procid:::jsonf:pid%}}"
*.* @@mylogstashhost:5543;ls_json
@alexyoung
alexyoung / tmux.conf
Created July 19, 2013 16:12
tmux cheap powerline
#!/usr/bin/env sh
ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%\n", $10/$5 * 100)}'
#!/usr/bin/env ruby
# SweDB XMLTV Grabber for EyeTV
# by Henrik Nyh <http://henrik.nyh.se> under the MIT License.
#
# INSTALLATION
#
# Configure the list of channels below and run this script as a cron job, e.g.
#
# 0 */12 * * * ruby /path/to/this/script.rb
@cdemers
cdemers / CoreOS_install_socat.sh
Last active September 14, 2017 19:08
Install the socat binary into a CoreOS installation
# Insightful instructions, originally posted by Xynova (https://github.com/xynova)
# Make socat directories
mkdir -p /opt/bin/socat.d/bin /opt/bin/socat.d/lib
# Create socat wrapper
cat << EOF > /opt/bin/socat
#! /bin/bash
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/bin
LD_LIBRARY_PATH=/opt/bin/socat.d/lib:$LD_LIBRARY_PATH exec /opt/bin/socat.d/bin/socat "\$@"