Skip to content

Instantly share code, notes, and snippets.

% 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 / 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
@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
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()
<?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:
################################################################################
# terminal/prompt stuff
################################################################################
BLUE="\[\033[0;34m\]"
CYAN="\[\033[0;36m\]"
GREEN="\[\033[0;32m\]"
RED="\[\033[0;31m\]"
MAGENTA="\[\033[0;35m\]"
YELLOW="\[\033[0;33m\]"
WHITE="\[\033[1;37m\]"
@thecarlhall
thecarlhall / nginx.conf
Created September 3, 2013 06:15
Example nginx configuration for Drupal from http://wiki.nginx.org/Drupal
server {
server_name {{ server_name }};
root {{ server_root }}; ## <-- Your only path reference.
# Enable compression, this will help if you have for instance advagg‎ module
# by serving Gzip versions of the files.
gzip_static on;
location = /favicon.ico {
log_not_found off;
[user]
name = Carl Hall
email = [email protected]
[rerere]
enabled = 1
[core]
excludesfile = /Users/carl/.gitignore_global
pager = less -r
[color]
ui = auto
@thecarlhall
thecarlhall / gist:9769769
Created March 25, 2014 19:46
keybase.md
### Keybase proof
I hereby claim:
* I am thecarlhall on github.
* I am thecarlhall (https://keybase.io/thecarlhall) on keybase.
* I have a public key whose fingerprint is A91D B52F 5B79 FDF7 8148 F10A 8418 AB87 21C8 CE0E
To claim this, I am signing this object:
@thecarlhall
thecarlhall / templates_slash_Java.xml
Created September 30, 2015 01:00
Intellij Live Template for create a fluent "with" method for a Java class variable.
<templateSet group="Java">
<template name="with" value="public $CLASS_NAME$ with$NAME$($VAR_TYPE$ $VAR_NAME$) {&#10; this.$VAR_NAME$ = $VAR_NAME$;&#10; return this;&#10;}&#10;$END$" description="Fluent getter" toReformat="false" toShortenFQNames="true">
<variable name="CLASS_NAME" expression="className()" defaultValue="" alwaysStopAt="false" />
<variable name="NAME" expression="" defaultValue="&quot;Name&quot;" alwaysStopAt="true" />
<variable name="VAR_NAME" expression="decapitalize(NAME)" defaultValue="$NAME" alwaysStopAt="false" />
<variable name="VAR_TYPE" expression="typeOfVariable(VAR_NAME)" defaultValue="$VAR_NAME" alwaysStopAt="false" />
<context>
<option name="JAVA_CODE" value="true" />
<option name="JAVA_STATEMENT" value="true" />
<option name="JAVA_EXPRESSION" value="true" />