Skip to content

Instantly share code, notes, and snippets.

View AlainODea's full-sized avatar

Alain O'Dea AlainODea

View GitHub Profile
@AlainODea
AlainODea / create_i386_smartmachine.sh
Last active December 26, 2015 10:19
SmartOS Haskell Platform for i386
# assuming you have Joyent Compute Service available
sdc-createmachine --dataset b83f8276-1fdd-11e3-989b-4bddb088a8a0 --package g3-standard-0.625-smartos --name alain-demo-$(uuid) | json -a id
@AlainODea
AlainODea / create_build_machine.sh
Last active December 26, 2015 15:49
Creating an x86_64 (64-bit) SmartOS PKGSRC 2013Q3 build system
#!/usr/bin/env bash
sdc-createmachineandwait 17c98640-1fdb-11e3-bf51-3708ce78e75a g3-highcpu-1.75-smartos
@AlainODea
AlainODea / omnios-smartmachine.erb
Last active December 26, 2015 22:09
WIP: OmniOS Chef bootstrap to make it act like a SmartMachine
# "Make OmniOS act as a SmartMachine" Knife Bootstrap
# Copy this file to: ~/.chef/bootstrap/joyent-smartmachine.erb
# To use via Knife: knife bootstrap <hostname|ip> -d joyent-smartmachine [-r recipe1,recipe2,...] [-N nodename]
bash -c '
cat > /etc/release <<'EOF'
SmartOS x86_64
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
Copyright 2010-2012 Joyent, Inc. All Rights Reserved.
@AlainODea
AlainODea / replace_pkgsrc.sh
Created October 31, 2013 13:41
WIP: Replace one PKGSRC version with another on a SmartMachine
#!/usr/bin/env bash
# get list of installed packages
pkg_info | cut -d' ' -f 1 | sed 's/-[^-]*$//' > packages.list
# replace existing PKGSRC
rm -Rf /opt/local /var/db/pkgin
curl -s http://pkgsrc.joyent.com/packages/SmartOS/bootstrap/bootstrap-$PKGSRC-$ARCH.tar.gz | gzcat | (cd /; tar -xpf -)
pkgin -y update
pkgin -y upgrade
@AlainODea
AlainODea / haskell_amqp_tls.sh
Created December 8, 2013 01:28
Haskell AMQP with TLS Support
#!/usr/bin/env bash
git clone [email protected]:AlainODea-haskell/amqp.git
git clone [email protected]:vincenthz/hs-connection.git
git clone [email protected]:vincenthz/hs-tls.git
git clone git://github.com/haskell/cabal.git
pushd cabal
cabal install Cabal/ cabal-install/
export PATH=~/.cabal/bin:$PATH
popd
pushd hs-connection
@AlainODea
AlainODea / 0001-BUGFIX-Handle-eROFS-as-permission-denied.patch
Created February 6, 2014 02:42
Patch for defect in System.Posix.fileAccess on a read-only file system.
From 5c5ea6bb96522a42634c9e803f387a617c70238e Mon Sep 17 00:00:00 2001
From: Alain O'Dea <[email protected]>
Date: Wed, 5 Feb 2014 21:24:28 +0000
Subject: [PATCH] BUGFIX: Handle eROFS as permission denied
---
System/Posix/Files.hsc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc
@AlainODea
AlainODea / pargs.d
Last active July 23, 2017 17:08
DTrace detailed program arguments (destructive hack)
#!/usr/sbin/dtrace -s
#pragma D option destructive
proc:::exec-success
/execname == $$1/
{
trace(pid);
stop();
system("pargs %d ; prun %d", pid, pid);
@AlainODea
AlainODea / stop_on_ld.d
Created March 23, 2014 17:15
Using DTrace to stop (freeze, but not kill) a program when it runs ld (used to debug GHC issues)
#!/usr/sbin/dtrace -s
#pragma D option destructive
syscall::exec*:entry
/copyinstr(arg0) == "/usr/bin/ld"/
{
trace(pid);
stop();
system("pargs %d", pid);
@AlainODea
AlainODea / fix_haskell_unix_package.sh
Last active August 29, 2015 13:58
Working around Cabal install getting "setup: /usr/bin/ld: permission denied" on SmartOS
#!/usr/bin/env bash
# assuming: pkgin -y install build-essential haskell-platform
git clone https://github.com/ghc/packages-unix.git
cd packages-unix/
git checkout -b smartos-fix-ghc-7.6.3 ghc-7.6.3-release
git apply ../patch-System-Posix-Files.hsc
autoreconf -i
cabal configure
cabal build
# this is an ugly hack
@AlainODea
AlainODea / ghc-builder-client.xml
Last active August 29, 2015 13:58
WIP: SMF manifest for GHC builder client (aka build slave)
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="ghc-builder-client">
<service name="site/ghc-builder-client" type="service" version="1">
<create_default_instance enabled="false" />
<single_instance />
<dependency name='network' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/network:default' />
</dependency>
<dependency name='filesystem-local' grouping='require_all' restart_on='none' type='service'>