Skip to content

Instantly share code, notes, and snippets.

View mattconnolly's full-sized avatar

Matt Connolly mattconnolly

View GitHub Profile
@mattconnolly
mattconnolly / gist:4158961
Created November 28, 2012 04:04
RSpec basic authentication helper module for request and controller specs
module AuthHelper
def http_login
user = 'username'
pw = 'password'
request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user,pw)
end
end
module AuthRequestHelper
#
@mattconnolly
mattconnolly / gist:5023574
Created February 24, 2013 12:03
Trying to install ruby-2.0.0 with rvm on OpenIndiana
matt@vault:~$ ac_cv_func_dl_iterate_phdr=no rvm install ruby-2.0.0 --trace
ruby-2.0.0 --trace
rvm 1.18.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
+ 1361707359.143632375 /scripts/cli : __rvm_parse_args() 725 > [[ -n '' ]]
+ 1361707359.147223303 /scripts/cli : __rvm_parse_args() 727 > set -o errtrace
+ 1361707359.150826442 /scripts/cli : __rvm_parse_args() 728 > export 'PS4=+ $(date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ 1361707359.154520553 /scripts/cli : __rvm_parse_args() 728 > PS4='+ $(date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ 1361707359.158231865 /scripts/cli : __rvm_parse_args() 760 > [[ -z install ]]
diff --git a/distrib/initscripts/Makefile.am b/distrib/initscripts/Makefile.am
index 5bdf951..bee3677 100644
--- a/distrib/initscripts/Makefile.am
+++ b/distrib/initscripts/Makefile.am
@@ -140,7 +140,7 @@ endif
if USE_SOLARIS
-servicedir = /lib/svc/manifest/network/
+servicedir = /var/svc/manifest/network/
@mattconnolly
mattconnolly / netatalk 3.0.3 build output
Created March 26, 2013 11:22
Configure and make output for netatalk 3.0.3 on SmartOS
matt@vault:~/netatalk/netatalk-3.0.3$ ./configure --with-bdb=/opt/local --with-init-style=solaris --with-init-dir=/var/svc/manifest/network/ --prefix=/opt/local
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
checking for a BSD-compatible install... /opt/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/local/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
@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];