Skip to content

Instantly share code, notes, and snippets.

View bixu's full-sized avatar
🦎

Blake Irvin bixu

🦎
  • Berlin
  • 18:39 (UTC +02:00)
View GitHub Profile
@bixu
bixu / circonus_httptrap_push.sh
Created January 28, 2016 17:07
Send a key:value pair to a Circonus HTTPTrap endpoint
#!/bin/bash
# Note that the -k flag here means we are ignoring cert warnings.
# If security matters you should use the Circonus cert provided
# here: http://login.circonus.com/pki/ca.crt
KEY=$1
VALUE=$2
ENDPOINT_URL=$3
@bixu
bixu / gist:7091748
Created October 21, 2013 22:03
proposed future svcadm/smf behavior
> svcprop /application/management/redis | grep "^start"
start/exec astring /usr/local/bin/redis-server\ /etc/redis/redis.conf\ \&
start/timeout_seconds count 60
start/type astring method
> svcprop /application/management/redis | grep "^stop"
stop/exec astring /usr/bin/bash\ -c\ \'LISTEN=\`netstat\ -an\ \|\ grep\ \"127.0.0.1.6379\"\ \|\ grep\ LISTEN\`\;\ if\ [\ !\ -z\ \"$LISTEN\"\ ]\;\ then\ /usr/local/bin/redis-cli\ -h\ 127.0.0.1\ -p\ 6379\ shutdown\;\ fi\'
stop/timeout_seconds count 300
stop/type astring method
> prstat -s rss -mL
PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWPID
78760 root 0.0 0.0 0.0 0.0 0.0 100 0.0 0.0 0 0 0 0 redis-server/3
78760 root 0.0 0.0 0.0 0.0 0.0 100 0.0 0.0 0 0 0 0 redis-server/2
78760 root 0.2 0.1 0.0 0.0 0.0 0.0 100 0.0 508 0 1K 0 redis-server/1
15224 root 0.0 0.0 0.0 0.0 0.0 100 0.0 0.0 0 0 0 0 redis-server/3
15224 root 0.0 0.0 0.0 0.0 0.0 100 0.0 0.0 0 0 0 0 redis-server/2
15224 root 0.2 0.1 0.0 0.0 0.0 0.0 100 0.0 504 0 1K 0 redis-server/1
16265 root 0.0 0.0 0.0 0.0 0.0 100 0.0 0.0 0 0 0 0 redis-server/3
16265 root 0.0 0.0 0.0 0.0 0.0 100 0.0 0.0 0 0 0 0 redis-server/2
@bixu
bixu / gist:6195826
Last active December 20, 2015 21:09
## Dedicated 32-core compute nodes
4994a399-ff31-4a85-91c0-80bc5501dfb2 Memory size: 32768 Megabytes caps:4:cpucaps_zone_4:baseline 482 cpu_alloc:32 zone.cpu-shares privileged 256 - none -
12b5afe2-dc4a-4578-b70b-d0a9731f23fd Memory size: 32768 Megabytes caps:4:cpucaps_zone_4:baseline 482 cpu_alloc:32 zone.cpu-shares privileged 256 - none -
669e78bf-23fb-4187-9a23-203099f81488 Memory size: 32768 Megabytes caps:5:cpucaps_zone_5:baseline 482 cpu_alloc:32 zone.cpu-shares privileged 256 - none -
25f3a19b-a0b8-4968-a69b-1d425d07a945 Memory size: 32768 Megabytes caps:5:cpucaps_zone_5:baseline 482 cpu_alloc:32 zone.cpu-shares privileged 256 - none -
bb6838d3-40d4-4fcf-be1a-4f9d4b531365 Memory size: 32768 Megabytes caps:6:cpucaps_zone_6:baseline 482 cpu_alloc:32 zone.cpu-shares privileged 256 - none -
e7e99079-fb23-467d-9139-606c50b9b803 Memory size: 32768 Megabytes caps:6:cpucaps_zone_6:baseline 482 cpu_alloc:32 zone.cpu-shares privileged 256 - none -
2226eff3-ce6c-4ca
@bixu
bixu / default_spec.rb
Last active December 18, 2015 14:51
default_spec for docker builds (this one is ubuntu-specific)
require 'spec_helper'
describe "Dockerfile" do
before(:all) do
image = Docker::Image.build_from_dir('.') do |v|
if (log = JSON.parse(v)) && log.has_key?("stream")
$stdout.puts log["stream"]
end
end
@bixu
bixu / spec_helper.rb
Created December 18, 2015 13:14
spec_helper for docker builds
require 'docker' # see https://rubygems.org/gems/docker-api
require 'serverspec' # see http://serverspec.org
set :backend, :exec
Excon.defaults[:write_timeout] = 1000
Excon.defaults[:read_timeout] = 1000
@bixu
bixu / ruby-2.0.0-p0 on smartos
Last active December 15, 2015 20:09
build ruby-2.0.0-p0 on smartos / illumos, including commonly-used libs/headers, etc - tested on smartos_bas64_1.9.1
## curl the raw version of this gist like this:
## curl -s -L https://gist.github.com/bixu/5316445/raw/[revision]/ruby-2.0.0-p0+on+smartos | bash
pkgin -y install build-essential libyaml readline libxml2 libxslt postgresql92-client
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
{
"brand": "joyent",
"image_uuid": "cf7e2f40-9276-11e2-af9a-0bad2233fb0b",
"max_physical_memory": 512,
"quota": 20,
"nics": [
{
"nic_tag": "admin",
"ip": "dhcp",
"primary": true
## these are 8GB smartmachine zones
> prctl -n zone.cpu-shares -i zone $(zonename)
zone: 57: 81bfaea9-a15f-4d54-b5f4-f4b80082d528
NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT
zone.cpu-shares
usage 8.19K
privileged 8.19K - none -
system 65.5K max none -
[root@08-00-27-ca-21-aa ~]# vmadm create -f /etc/base64.1.8.1.json
UNCAUGHT EXCEPTION (acff1491): dumping core
/usr/vm/sbin/vmadm:645:28
fs.readFile (fs.js:176:14)
Object.oncomplete (fs.js:297:15)
Abort (core dumped)