Skip to content

Instantly share code, notes, and snippets.

View jaredmorrow's full-sized avatar

Jared Morrow jaredmorrow

View GitHub Profile
@aschepis
aschepis / config.erl
Created August 24, 2011 17:37
Updating properties in a riak config file
#!/usr/bin/env escript
-export([main/1]).
main([]) ->
{ok,[AppConfig]} = file:consult("app.config"),
[Http] = get_config_value(AppConfig, riak_core, http),
io:format("HTTP Address: ~p~n", [Http]),
Updated = update_config_value(AppConfig, riak_core, http, [{"0.0.0.0", 8080}]),
io:format("Original Values:~n~p~n", [AppConfig]),
io:format("Updated Values:~n~p~n", [Updated]).
@jaredmorrow
jaredmorrow / ssh pub key
Created September 6, 2011 23:58
Jared (Basho) SSH Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtcK9RaMacrCGw33ALoPDXm85VsmSFe33qg4yjg+/2QWs1ti7HYgS1uCnfuP9/kuYaNK1MbGfk2l1rScSwKv3GP+uyDttKTRQPkLJEmcqaoSv3tjfl1rG44IuKGIGNrcVWGF2/5qGp4r64BRMPzsJi8LSeEAPMulM7KcZLEdXIf1vsBPa8HMFbUUrYIIfI6xzKgOFA2fBedsrVKd+dn+sYb7lRkDWCVmabqHz/Q8nV\
km9tZ/4EHrbHllDicBhCc+wOP+Z7vIk0r2o1Cc4l2ArElVi0F7z8ipAU9jsl3yjfyzhtNdBgiiosgLAwIpHwbsiqVaFqHadqSrcuvDM2PrhVw== jared@basho.com
@mbbx6spp
mbbx6spp / create_system_user.sh
Created December 7, 2011 06:19
Removing the crazy amount of hoops you need to jump through to create system users on OS X. I can't believe how painful this is. These thirteen commands are just two on Linux and real BSDs. WTF?
# These are bash functions. You can just source them on startup based on uname
# if you use the same dotfiles for all systems.
function listUsers() {
dscl . -list /Users UniqueID;
}
function listGroups() {
dscl . -list /Groups PrimaryGroupID;
}
@mbbx6spp
mbbx6spp / README.md
Created January 3, 2012 05:34
Retaining Git history of subdirectory from parent repository

Subdirectory Git Repository

This is a mini howto on moving a subdirectory to its own repository retaining history

Howto

Assume PARENT is the original parent Git repository (locally) and CHILD is the new local repository that you wish to create from a subdirectory, retaining all of its history from the PARENT repository; PARENT_PATH and CHILD_PATH are the paths to PARENT and CHILD respectively; SUBDIR is the relative path within the repository under extraction:

  1. git clone --no-hardlinks PARENT_PATH CHILD_PATH
  2. pushd CHILD_PATH
if [ ! $# == 2 ]; then
echo "Usage: $( basename $0 ) /path/to/bin/riak dest_dir"
exit
fi
src_riak_script="$1"
src_riak_root="$( cd -P "$( dirname "$1" )" && pwd )"
src_riak_admin_script="$src_riak_root/riak-admin"
src_riak_search_cmd="$src_riak_root/search-cmd"
@lusis
lusis / autostart.md
Created February 2, 2012 05:36
Why autostarting default config packages are a bad thing

For a moment, I'm going to throw away my automation and configuration management hat. I'll let you know when I put it back on. Also, let's ignore that we're talking about Riak specifically for a moment. Also also, let's ignore any (for a brief moment) the proper role of a package manager.

What's your target market?

If you're writing server software, you have two target markets. The system administrator/operations team and the developer.

Why do you want autostart?

The main reason you want autostart is to get people up and running quickly. To do this, you need to ship safe and sane defaults. This means something like a default configuration that listens only on localhost.

Adrian -

I appreciate that you spent time in writing this post. I know I've been up until 2am writing similarly long ones as well. I will take responsibility for having what is likely an irrational response (I blame Twitter for that) to the term "NoOps", but I invite you to investigate why that might be. I'm certainly not the only one who feels this way, apparently, and thus far have decided this issue is easily the largest distraction in my field I've encountered in recent years. I have had the option to simply ignore my opposition to the term, and just let the chips fall where they may with how popular the term "NoOps" may or may not get. I have obviously not taken that option in the past, but I plan to in the future.

You're not an analyst saying "NoOps". Analysts are easy (for me) to ignore, because they're not practitioners. We have expectations of engineering maturity from practitioners in this field of web engineering, especially those we consider leaders. I don't have any expectations from analysts,

-module(timeit).
-export([timeit/3,
timeit/4,
timeit/5]).
-export([simple_test/0]).
timeit(Mod, Fun, Arity) ->
timeit(all, Mod, Fun, Arity, undefined).
@jclulow
jclulow / 00_info.md
Created May 5, 2012 23:46
SmartOS rc.local

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.

gsed -i -e 's:OpenSolaris:OmniOS:g' $TMPDIR/$BUILDDIR/package/Makefile
$MAKE clean
CC=gcc CXX=g++ CFLAGS="-m64" $MAKE -C package buildrel REPO=riak REPO_TAG=riak-$VER PKG_VERSION=$VER
mkdir -p $DESTDIR/$PREFIX
cp -r -p rel/riak/* $DESTDIR/$PREFIX/