Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to Jasig under one or more contributor license
agreements. See the NOTICE file distributed with this work
for additional information regarding copyright ownership.
Jasig licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a
copy of the License at the following location:
set nocompatible " be iMproved
" this little dance it to get a 0 exit code for git commit
filetype plugin indent on
filetype plugin indent off
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
@thecarlhall
thecarlhall / erlang_mr.rb
Last active December 12, 2015 09:28
Ad-hoc Erlang Map/Reduce in Riak using Ruby
module Riak
class MapReduce
def self.bucket_name
'super_awesome_bucket'
end
def self.get_keys
# TODO get the keys to process by querying an index or listing all keys in a bucket
[]
end
@thecarlhall
thecarlhall / riak_ping.sh
Last active December 12, 2015 01:08
Riak status shell function
riak_ping() {
NODES=$(dig +short A production-reporting-source-129485720.us-east-1.elb.amazonaws.com)
for n in $NODES; do
echo "Server ${n}: $(curl --connect-timeout 3 -s -k https://${n}:8080/ping)" &
done
}
alias riak_ping=riak_ping
% start with this
map_reindex({error,notfound}, _, _) ->
[];
map_reindex(RiakObject, _, _) ->
riak_search_kv_hook:precommit(RiakObject),
[].
% and convert to this
fun({error,notfound}, _, _) ->
[];
@thecarlhall
thecarlhall / gist:4021017
Last active October 12, 2015 11:38
bash prompt for git
function parse_git_branch {
git rev-parse --git-dir &> /dev/null
git_status="$(git status 2> /dev/null)"
branch_pattern="^On branch ([^${IFS}]*)"
remote_pattern="# Your branch is ([[:alnum:]]*)"
diverge_pattern="# Your branch and (.*) have diverged"
if [[ ${git_status} =~ ${branch_pattern} ]]; then
branch=${BASH_REMATCH[1]}
if [[ ${git_status} =~ "Changes not staged for commit" ]]; then
$ sudo apt-get install ffmpeg youtube-dl
$ sudo install youtube2mp3 /usr/local/bin/
@thecarlhall
thecarlhall / org.sakaiproject.nakamura.composite
Created July 25, 2012 01:49
Pax Runner profile for Sakai OAE 1.4.0-SNAPSHOT
#########################################################################
# Pax Runner profile for Sakai OAE 1.4.0-SNAPSHOT using Apache Felix Http
#########################################################################
#
##### Dependencies
#
# start level 1
scan-bundle:mvn:commons-io/commons-io/1.4@1
scan-bundle:mvn:commons-fileupload/commons-fileupload/1.2.2@1
scan-bundle:mvn:commons-collections/commons-collections/3.2.1@1
@thecarlhall
thecarlhall / JcrSparseTest.java
Created March 6, 2012 22:13
Unit Test Mocks for JCR, Sparse Sessions
private javax.jcr.Session jcrSession;
private org.sakaiproject.nakamura.api.lite.Repository repository;
private org.sakaiproject.nakamura.api.lite.Session session;
// Create an in-memory repository to work with
repository = new BaseMemoryRepository().getRepository();
// mock a jcr session but also include SessionAdaptable for easier mocking to a sparse session
jcrSession = mock(javax.jcr.Session.class, Mockito.withSettings().extraInterfaces(SessionAdaptable.class));
@thecarlhall
thecarlhall / page.tpl.php
Created February 10, 2012 02:15
AAR updates to seven/page.tpl.php
<?php
?>
<div id="branding" class="clearfix">
<?php print $breadcrumb; ?>
<?php print render($title_prefix); ?>
<?php if ($title): ?>
<h1 class="page-title"><?php print $title; ?></h1>
<?php endif; ?>
<?php print render($title_suffix); ?>