Skip to content

Instantly share code, notes, and snippets.

@chorrell
chorrell / download-images.sh
Created Oct 24, 2016
Example of how to download images files from https://images.joyent.com
View download-images.sh
# Get the manifest
curl https://images.joyent.com/images/70e3ae72-96b6-11e6-9056-9737fd4d0764 -o base-64-16.3.1.json
# Get the image file
curl https://images.joyent.com/images/70e3ae72-96b6-11e6-9056-9737fd4d0764/file -o base-64-16.3.1.zfs.gz
View gist:4b410d79166eb23d75e5
dpkg: dependency problems prevent removal of systemd-sysv:
init depends on systemd-sysv | sysvinit-core | upstart; however:
Package systemd-sysv is to be removed.
Package sysvinit-core is not installed.
Package upstart is not installed.
dpkg: error processing package systemd-sysv (--purge):
dependency problems - not removing
dpkg: dependency problems prevent removal of systemd:
systemd-sysv depends on systemd (= 215-17).
@chorrell
chorrell / test-npm.sh
Created Apr 2, 2015
Test install npm 2.7.4 with node 0.8.28
View test-npm.sh
#!/bin/bash
set -o xtrace
export npm_config_loglevel=verbose
export npm_config_spin=false
NODE_VERSION=0.8.28
NPM_VERSION=2.7.4
# Install node
View keybase.md

Keybase proof

I hereby claim:

  • I am chorrell on github.
  • I am chorrell (https://keybase.io/chorrell) on keybase.
  • I have a public key whose fingerprint is 323A EC58 E07B B77C EEC0 0590 6E82 CA41 2774 7B7C

To claim this, I am signing this object:

@chorrell
chorrell / ghost.xml
Last active Dec 28, 2015
SMF manifest for Ghost. Assumes you are installing in /home/ghost and run as the ghost user (and group). Also sets NODE_ENV to "production"
View ghost.xml
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="ghost">
<service name="site/ghost" type="service" version="1">
<create_default_instance enabled="true"/>
<single_instance/>
@chorrell
chorrell / gist:6688898
Last active Dec 23, 2015
user-script example for the joyent api. In this example, provision a base 13.1.0 image (f669428c-a939-11e2-a485-b790efc0f0c1) using package g3-g3-standard-0.625-smartos (6a6c0056-38b9-4982-90ad-682d63970b4) called base-13.1.0-with-git" with git installed
View gist:6688898
The script (/Users/christopher/script.sh):
/opt/local/bin/pkgin -y install scmgit
The api command:
Create a machine and pass the absolute path of the script to --script:
sdc-createmachine --dataset f669428c-a939-11e2-a485-b790efc0f0c1 --package 6a6c0056-38b9-4982-90ad-682d63970b4c --name base-13.1.0-with-git --script /Users/christopher/script.sh
@chorrell
chorrell / backup-keys.sh
Last active Dec 17, 2015
Backup ssh keys from your Joyent account to /root/.ssh/authorized_keys. Don't forget to change ACCOUNT, DC, and AUTHORIZED_KEYS. Schedule this via cron to always ensure you have a recent backup NOTE: this assumes you have smartdc (the latest 7.0 version) and jsontool installed (via npm): 'npm install smartdc -g; npm install jsontool -g`
View backup-keys.sh
#!/bin/bash
PKGSRCPATH=/opt/local
ACCOUNT=YOUR-USER-NAME
FINGERPRINT=`ssh-keygen -l -f ~/.ssh/id_rsa.pub | awk '{print $2}' | tr -d '\n'`
URL=https://DC.api.joyentcloud.com
AUTHORIZED_KEYS=/root/.ssh/authorized_keys
${PKGSRCPATH}/bin/sdc-listkeys --account ${ACCOUNT} --keyId ${FINGERPRINT} --url ${URL} | ${PKGSRCPATH}/bin/json -a key > ${AUTHORIZED_KEYS}
@chorrell
chorrell / gist:3295245
Created Aug 8, 2012
add ffmpeg-php to a smartosplus64 3.1.0 SmartMachine
View gist:3295245
# Install ffmpeg and autoconf from the pkgsrc repos
pkgin update
pkgin -y install ffmpeg autoconf gcc-compiler
mkdir src
cd src
# Download ffmpeg-php
curl -L -O http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2
@chorrell
chorrell / gist:3182892
Created Jul 26, 2012
Install gearmand-0.33 on smartos64 1.6.3 SmartMachine
View gist:3182892
curl -OLk https://launchpad.net/gearmand/trunk/0.33/+download/gearmand-0.33.tar.gz
tar xvf gearmand-0.33.tar.gz
cd gearmand-0.33
pkgin -y install libevent boost-headers boost-libs gcc-compiler gmake curl
export CFLAGS='-m64 -I/opt/local/include'
export CPPFLAGS='-I/opt/local/include -D_REENTRANT -I/usr/include'
export CXXFLAGS='-m64 -L/opt/local/lib/amd64'
export LDFLAGS='-m64 -I/opt/local/include -L/opt/local/lib -L/opt/local/lib/amd64'
@chorrell
chorrell / gist:3180044
Created Jul 26, 2012
Install taglib-ruby gem on a 64 bit SmartMachine
View gist:3180044
# Download the required TagLib lib
mkdir src
cd src
curl -OL https://github.com/downloads/taglib/taglib/taglib-1.7.2.tar.gz
tar xvf taglib-1.7.2.tar.gz
cd taglib-1.7.2
# Make sure cmake and gcc are installed
pkgin -y install cmake