Skip to content

Instantly share code, notes, and snippets.

View mattconnolly's full-sized avatar

Matt Connolly mattconnolly

View GitHub Profile
@mattconnolly
mattconnolly / gist:5298331
Created April 3, 2013 03:54
Amazon create AMI durations API call durations
Done, Database read lock held for 9.728 seconds
Done, Database read lock held for 2.599 seconds
Done, Database read lock held for 8.635 seconds
Done, Database read lock held for 3.085 seconds
Done, Database read lock held for 2.468 seconds
Done, Database read lock held for 96.438 seconds
Done, Database read lock held for 3.439 seconds
Done, Database read lock held for 17.616 seconds
Done, Database read lock held for 181.520 seconds
Done, Database read lock held for 15.200 seconds
@mattconnolly
mattconnolly / gist:5354171
Created April 10, 2013 12:25
Difference between compiling netatalk in 2 zones.
--- netatalk-netatalk.txt 2013-04-10 21:06:48.000000000 +1000
+++ netatalk-vault-admin.txt 2013-04-10 21:15:42.000000000 +1000
@@ -1,4 +1,4 @@
-[admin@netatalk ~/netatalk-3.0.3]$ ./configure --prefix=/opt/local --with-init-style=solaris --with-init-dir=/var/svc/manifest/network/ --with-bdb=/opt/local && make
+[admin@vault ~/netatalk-3.0.3]$ ./configure --prefix=/opt/local --with-init-style=solaris --with-init-dir=/var/svc/manifest/network/ --with-bdb=/opt/local && make
checking build system type... x86_64-pc-solaris2.11
checking host system type... x86_64-pc-solaris2.11
checking target system type... x86_64-pc-solaris2.11
@@ -202,7 +202,8 @@
checking rpcsvc/rquota.h presence... yes
@mattconnolly
mattconnolly / pkgin-ls-output
Created April 15, 2013 06:09
`pkgin ls` output
[admin@rvm ~]$ pkgin ls
autoconf-2.69nb1 Generates automatic source code configuration scripts
automake-1.12.6 GNU Standards-compliant Makefile generator
bash-4.2nb2 The GNU Bourne Again Shell
binutils-2.22nb1 GNU binary utilities
bison-2.7 GNU yacc(1) replacement
bmake-20110606 Portable (autoconf) version of NetBSD 'make' utility
bootstrap-mk-files-20120415 *.mk files for the bootstrap bmake utility
bzip2-1.0.6 Block-sorting file compressor
changepass-1.3.3 Simple tool to set user passwords non-interactively
@mattconnolly
mattconnolly / gist:5411998
Last active December 16, 2015 09:19
Attempting to build ruby-2.0.0 in SmartOS
[admin@test1 ~]$ openssl md5 ruby-2.0.0-p0.tar.gz
MD5(ruby-2.0.0-p0.tar.gz)= 50d307c4dc9297ae59952527be4e755d
[admin@test1 ~]$ pkgin list
autoconf-2.69nb1 Generates automatic source code configuration scripts
automake-1.12.6 GNU Standards-compliant Makefile generator
binutils-2.22nb1 GNU binary utilities
bison-2.7 GNU yacc(1) replacement
bmake-20110606 Portable (autoconf) version of NetBSD 'make' utility
bootstrap-mk-files-20120415 *.mk files for the bootstrap bmake utility
build-essential-1.0 Meta-package for essential build utilities
@mattconnolly
mattconnolly / gist:5669500
Created May 29, 2013 11:02
layout method to distribute subviews with even spaces between them. Simple task to achieve. Ridonkulously difficult with auto layout.
- (void)layoutSubviews
{
[super layoutSubviews];
CGRect bounds = self.bounds;
CGRect rect;
CGFloat usedHeight = 0;
int numViewsPlusOne = 1;
NSArray* viewsSortedByVerticalPosition = [self.subviews sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
@mattconnolly
mattconnolly / gist:5678362
Last active December 17, 2015 21:59
Cut down piece of code to scan for interfaces on SmartOS. Very basic at this stage. Based on code from samba: http://ftp.samba.org/pub/unpacked/ctdb/lib/replace/getifaddrs.c
/* this works for Linux 2.2, Solaris 2.5, SunOS4, HPUX 10.20, OSF1
* V4.0, Ultrix 4.4, SCO Unix 3.2, IRIX 6.4 and FreeBSD 3.2.
*
* It probably also works on any BSD style system. */
int max_interfaces=8;
int scan_interfaces()
{
struct ifconf ifc;
char buff[8192];
@mattconnolly
mattconnolly / gist:5737555
Created June 9, 2013 03:52
gdb backtrace of crash in czmq self test.
Core was generated by `/home/admin/czmq/src/.libs/czmq_selftest'.
Program terminated with signal 9, Killed.
#0 0xfffffd7fff273d9a in __pollsys () from /lib/64/libc.so.1
(gdb) bt
#0 0xfffffd7fff273d9a in __pollsys () from /lib/64/libc.so.1
#1 0xfffffd7fff25e585 in _pollsys () from /lib/64/libc.so.1
#2 0xfffffd7fff20a0d6 in poll () from /lib/64/libc.so.1
#3 0xfffffd7feeee1577 in zmq::signaler_t::wait (this=<optimized out>, timeout_=<optimized out>) at signaler.cpp:145
#4 0xfffffd7feeed621a in zmq::mailbox_t::recv (this=0x42a428, cmd_=0xfffffd7fffdff630, timeout_=<optimized out>)
at mailbox.cpp:74
@mattconnolly
mattconnolly / gist:5963270
Last active December 19, 2015 13:38
rbczmq notes

Object Ownership:

CZMQ appears quite explicit about ownership of objects. For example:

  • zmsg_send will destroy the message when sent. This includes destroying any frames that are owned by the zmsg_t.
  • Calling zmsg_add means that the zmsg_t takes ownership of the zframe_t.

I was thinking about making this "ownership" concept an explicit state in the ruby wrappers. So:

  • zmq_message_wrapper would have a flag for "owning the message", which would be cleared when we send the message.
@mattconnolly
mattconnolly / gist:7748711
Last active December 30, 2015 00:19
Typing garbage into ZMQ router socket with Telnet.
MattbookPro:~ matt$ telnet localhost 5555
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
asdfasdfasdf
asdfasd
fasdfasdfasdfasd
fasdfawdawdfawe
@mattconnolly
mattconnolly / gist:8212674
Created January 1, 2014 23:16
sshkit within not applied to non-mapped commands
require 'sshkit'
require 'sshkit/dsl'
on 'example.com', user: 'matt' do
within('current') do
puts "this works as expected:"
puts capture :ls
puts "this does not get executed in the 'current' directory:"
puts capture 'ls -l'
end