Skip to content

Instantly share code, notes, and snippets.

file "/opt/local-user.txt" do
action :create
owner "root"
group "root"
content "jmara"
mode 00644
end
if File.exist?("/opt/local-user.txt")
user = File.read("/opt/local-user.txt")
do shell script "xcode-select --install"
do shell script "sleep 1"
tell application "System Events"
tell process "Install Command Line Developer Tools"
keystroke return
click button "Agree" of window "License Agreement"
end tell
end tell
include_recipe "apache"
include_recipe "php"
# Just to make it clear ;)
node.default["myface"]["template"] = "production.conf.erb"
if node.recipes.include?("myface::dev")
include_recipe "myface::dev"
end
@jmara
jmara / chefdk.sh
Last active August 29, 2015 14:09
chefdk.sh
#!/bin/bash
name="chefdk-0.3.2-1"
dmg="https://opscode-omnibus-packages.s3.amazonaws.com/mac_os_x/10.8/x86_64/${name}.dmg"
pkg="${name}.pkg"
mnt="/Volumes/Chef Development Kit"
test -f ${name}.dmg||curl -O ${dmg}
hdiutil attach ${name}.dmg
@jmara
jmara / gist:8035c07a86ff111465d9
Last active August 29, 2015 14:12
If distribution is Debian/Ubuntu
<?php
// Simple socket server
// See http://php.net/manual/en/function.stream-socket-server.php
$port = $argv[1];
$mysql_port = $argv[2];
$mysql = "/usr/bin/mysql";
$query = "SHOW SLAVE STATUS";
function set_weight($lag){
# Write your own rules here
if ($lag == 'NULL'){
@jmara
jmara / gist:530d2e789e74dddffc90
Last active August 29, 2015 14:14
jenkins-cli
import sys
from jenkinsapi.jenkins import Jenkins
# Requirement: https://github.com/salimfadhley/jenkinsapi
# pip install jenkinsapi
if len(sys.argv) == 1:
print "Usage: %s Jenkins-URL" % sys.argv[0]
exit(1)
@jmara
jmara / gist:ed4c874134f5c9b1c5b8
Last active August 29, 2015 14:15
ohai on XenServer 6.5
[2015-02-18T18:17:01+01:00] DEBUG: Plugin Ruby threw #<TypeError: can't convert nil into String>
[2015-02-18T18:17:01+01:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.4.1/lib/ohai/plugins/ruby.rb:70:in `join'
[2015-02-18T18:17:01+01:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.4.1/lib/ohai/plugins/ruby.rb:70:in `block (3 levels) in <main>'
[2015-02-18T18:17:01+01:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.4.1/lib/ohai/plugins/ruby.rb:68:in `map'
[2015-02-18T18:17:01+01:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.4.1/lib/ohai/plugins/ruby.rb:68:in `block (2 levels) in <main>'
[2015-02-18T18:17:01+01:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.4.1/lib/ohai/dsl/plugin/versionvii.rb:90:in `instance_eval'
[2015-02-18T18:17:01+01:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai-7.4.1/lib/ohai/dsl/plugin/versionvii.rb:90:in `run_plugin'
[2015-02-18T18:17:01+01:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/ohai
#!/bin/bash
#
# Bash script to setup headless Selenium (uses Xvfb and Chrome)
# (Tested on Ubuntu 12.04)
# Add Google Chrome's repo to sources.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
# Install Google's public key used for signing packages (e.g. Chrome)
# (Source: http://www.google.com/linuxrepositories/)
#! /bin/sh
### BEGIN INIT INFO
# Provides: varnishncsa
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start HTTP accelerator log daemon
# Description: This script provides logging for varnish
@jmara
jmara / gist:3532506
Created August 30, 2012 16:32
check_mysql_health
wget http://labs.consol.de/wp-content/uploads/2011/08/check_mysql_health-2.1.7.tar.gz
tar xfz check_mysql_health-2.1.7.tar.gz
cd check_mysql_health-2.1.7/
./configure
make && make install
Depends on Perl MySQL DBI / DBD
English docs: http://labs.consol.de/lang/en/nagios/check_mysql_health/