This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%\n", $10/$5 * 100)}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 "\$@" |
OlderNewer