This article is now published on my website: Prefer Subshells for Context.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pyrocfile - Simple Python impementation of Procfile manager | |
# Written by Chris Testa (http://testa.co/) in 2011 | |
# Released in the Public Domain | |
import argparse, logging, os.path, random, re, select, signal, subprocess | |
def _new_logger(name, color=None): | |
logger = logging.getLogger(name) | |
hdlr = logging.StreamHandler() | |
color, end_color = '\033[9%dm' % (color or random.randint(1, 6)), '\033[0m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Simple TCP server for playing Tic-Tac-Toe game. | |
Use Player-to-Player game mode based on naming auth. | |
No thoughts about distribution or pub/sub mode | |
(for monitoring or something like this). Just | |
basic functionality. | |
""" | |
import time | |
import logging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Created on Apr 27, 2012 | |
Based on echo server http://tornadogists.org/1231481/ by phus | |
@author: mark-allen | |
''' | |
import logging |
So, to get something like /etc/rc.local
you can use the custom SMF import facility. (See the source
for more information about how this actually works.)
/opt
is mounted out of zones/opt
by default. You can create a directory /opt/custom/smf
and populate it with SMF manifests. Any manifests you put in there will be imported by SmartOS when it boots. Below is an example SMF manifest that simply starts /opt/custom/bin/postboot
, a self-explanatory shell script that you can use like /etc/rc.local
.
Note that it would likely be better to customise and respin your own images, as putting a bunch of platform state in the zones pool undoes some of the benefits of the ramdisk platform architecture that SmartOS has.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import base64, hashlib, hmac, json, sys, getpass | |
from Crypto.Cipher import AES | |
from Crypto.Hash import RIPEMD, SHA256 | |
base58_chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' | |
def prompt(p): | |
return getpass.getpass(p + ": ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- encoding: utf-8 -*- | |
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8: | |
# Author: Binux<17175297.hk@gmail.com> | |
# http://binux.me | |
# Created on 2012-09-06 22:22:21 | |
import urlparse | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <cmath> | |
#include <functional> | |
#include <numeric> | |
#include <unordered_map> | |
#include <vector> | |
#include <stdint.h> | |
#include <stdio.h> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
if [ -z "$iso" ] ; then | |
printf -- ">>> You must invoke with iso=/path/to/winxp.iso $(basename $0)\n" | |
exit 1 | |
fi | |
if [ -z "$url" ] ; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jsonrpc | |
from jsonrpc import ServiceProxy | |
from os.path import expanduser | |
conf = {p[0]: p[1].strip() for p in | |
(l.split("=", 1) for l in open(expanduser("~/.bitcoin/bitcoin.conf"))) | |
if len(p) == 2} | |
proxy = ServiceProxy("http://%(rpcuser)s:%(rpcpassword)s@127.0.0.1:8332"%conf) | |
info = proxy.getinfo() |
OlderNewer