Skip to content

Instantly share code, notes, and snippets.

View bixu's full-sized avatar
🦎

Blake Irvin bixu

🦎
  • Berlin
  • 06:42 (UTC +02:00)
View GitHub Profile
@bixu
bixu / smartos_vagrant
Last active August 29, 2015 14:07
SmartOS in Vagrant!
monolith:~ blake$ vagrant plugin install vagrant-smartos-zones
monolith:~ blake$ mkdir smartos && cd smartos
monolith:smartos blake$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'livinginthepast/smartos'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'livinginthepast/smartos' is up to date...
==> default: Setting the name of the VM: smartos_default_1412188127370_65947
@bixu
bixu / get_broker_ids
Created July 9, 2014 13:34
How to get your circonus broker ID if you are using public circonus brokers
# this assumes that you have the latest node.js
sudo npm install -g json
curl -s \
-H 'X-Circonus-App-Name: nad' \
-H 'X-Circonus-Auth-Token: <your_auth_token>' \
-H 'Accept: application/json' 'https://api.circonus.com/broker' \
| json \
| grep "cid\|name"
@bixu
bixu / omnibus-chef_wrapper
Last active August 29, 2015 14:01
Wrapper script for building omnibus-chef for ubuntu LTS 12.0.4 with ruby 2.1.1
#!/bin/bash
set -e
chef_version="11.12.8"
if [ $(uname -a | grep -c Ubuntu) -eq 1 ]; then
packager="apt-get"
packages="build-essential git ruby1.9.1 ruby-bundler ruby1.9.1-dev"
else
@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 / 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)