Skip to content

Instantly share code, notes, and snippets.

View sax's full-sized avatar

Eric Saxby sax

View GitHub Profile
@sax
sax / omnibus-chef-stderr.txt
Last active August 29, 2015 13:56
omnibus-chef fails on SmartOS 13.3.1
[health_check] *** Health Check Failed, Summary follows:
[health_check] *** The following Omnibus-built libraries have unsafe or unmet dependencies:
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/readline.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/psych.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/openssl.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/iconv.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/digest/sha2.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/digest/sha1.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/digest/rmd160.so
[health_check] --> /opt/chef/embedded/lib/ruby/1.9.1/x86_64-solaris2.11/digest/md5.so
@sax
sax / 00_README.md
Last active August 29, 2015 13:56
Download latest SmartOS platform image and turn it into a VirtualBox VM

UPDATE: this has been made slightly more official by way of turning it into a repo: https://github.com/sax/vagrant-smartos-packager

Notes:

  • This will create files on the local disk
  • You'll probably want to create and cd into a working directory before doing any of this
  • This is very much a work in progress. This gist is to capture lots of tiny changes in code, without managing the horrible git history that would ensue in a real git repo. Once this works to completion, it's going into a github repo.

On local machine, download the latest SmartOS platform image and turn it into a virtualbox image:

@sax
sax / forking_off_cpu.d
Last active August 29, 2015 14:03
Slow forking analysis
#!/usr/bin/dtrace
syscall::forksys:entry
/pid == $target/
{
self->tracing = 1;
}
syscall::forksys:return
/pid == $target/
@sax
sax / gist:061f95d3c159b1a7a315
Created July 19, 2014 01:35
Add nictag to SmartOS global zone and use it to add interface to local zone#
# global zone
MAC_ADDRESS=$(dladm show-phys -m e1000g1 | tail +2 | awk '{ print $3 }')
ZONENAME=$(zoneadm list | grep -v global)
nictagadm add external "${MAC_ADDRESS}"
echo '{"add_nics":[{"nic_tag":"external","ip":"dhcp"}]}' | vmadm update ${ZONENAME}
@sax
sax / gist:99ae1591340be381f868
Last active August 29, 2015 14:05
Elasticsearch cross-index query spike
DELETE joininess-product
DELETE joininess-save
DELETE joininess-user
PUT joininess-product
PUT joininess-save
PUT joininess-user
DELETE joininess-product/_mapping/product
GET joininess-product/_mapping/product
@sax
sax / fork arguments
Last active August 29, 2015 14:09
Postgres slow forking
> sudo dtrace -n '::forksys:entry / pid == $target / { printf("%d %d", arg0, arg1); }' -p 7580
CPU ID FUNCTION:NAME
5 13517 forksys:entry 0 0
5 13517 forksys:entry 0 0
5 13517 forksys:entry 0 0
5 13517 forksys:entry 0 0
7 13517 forksys:entry 0 0
0 13517 forksys:entry 0 0
0 13517 forksys:entry 0 0
@sax
sax / partials.rb
Created April 6, 2010 16:38 — forked from lenary/partials.rb
partials for sinatra
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb
# and made a lot more robust by me
# this implementation uses erb by default. if you want to use any other template mechanism
# then replace `erb` on line 13 and line 17 with `haml` or whatever
require 'sinatra/base'
module Sinatra
module Partials
def partial(template, *args)
@sax
sax / gitconfig
Created July 6, 2010 23:46
git config
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
@sax
sax / nginx.plist
Created July 13, 2010 21:23
like apachectl, but for nginx
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key><string>nginx</string>
<key>Program</key><string>/usr/local/sbin/nginx</string>
<key>KeepAlive</key><true/>
<key>NetworkState</key><true/>
<key>StandardErrorPath</key><string>/var/log/nginx/error.log</string>
@sax
sax / nginx conf
Created July 13, 2010 20:27
nginx passenger config
#user nobody;
worker_processes 1;
daemon off;
error_log /var/log/nginx/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
pid /var/run/nginx.pid;