Skip to content

Instantly share code, notes, and snippets.

View smarj's full-sized avatar
🏠
Working from home

Bill Smargiassi smarj

🏠
Working from home
  • GitHub Staff
  • New Jersey
View GitHub Profile
@smarj
smarj / gist:b54d4622886ed8c4be23133d9da40d9a
Created May 21, 2018 22:32
CentOS7 Virtual Box error
==> default: Successfully added box 'centos/7' (v1804.02) for 'virtualbox'!
==> default: Importing base box 'centos/7'...
Progress: 90%There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["import", "/home/bill/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1804.02/virtualbox/box.ovf", "--vsys", "0", "--v$name", "centos-7-1-1.x86_64_1526939688635_30658", "--vsys", "0", "--unit", "7", "--disk", "/home/bill/VirtualBox VMs/ce$tos-7-1-1.x86_64_1526939688635_30658/centos-7-1-1.x86_64.vmdk"]
Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting /home/bill/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1804.02/virtualbox/box.ovf...
OK.
@smarj
smarj / example_errors.md
Created April 13, 2018 16:56 — forked from angrycub/example_errors.md
Examples of Riak Error Log Messages

eacces

Note: It is not eaccess

An example created when the ring folder is not owned by the user riak is running as:

2015-06-23 14:57:43.073 [error] <0.154.0>@riak_core_ring_manager:do_write_ringfile:236 Unable to write ring to "./data/ring/riak_core_ring.default.20150623185743" - {badmatch,{error,eacces}}

emfile

@smarj
smarj / riak-solr-count-fill.sh
Created May 23, 2017 16:23
Fill two Solr-indexed buckets with timestamps
#!/bin/bash
for bucket in $(seq -f "stest%g" 2 2); do
for key in $(seq -f "s2key%g" 1 10000); do
cdate=`date`
curl -XPUT ${RIAK}/types/solr/buckets/${bucket}/keys/${key} -H "Content-Type: application/json" -d "{\"name_s\":\"my${key}\", \"timestamp_s\":\"${cdate}\"}"
done
done
@smarj
smarj / createdrc.sh
Created May 23, 2017 15:24
Quickly create a 5 node Riak cluster with Docker
#!/bin/bash
SHARED=${HOME}/Documents/Docker/shared
if [[ ! -d "${SHARED}" ]]; then
mkdir -p "${SHARED}"
fi
docker run --name=riak1 -d -p 8087:8087 -p 8098:8098 --label cluster.name=adhoc -v ${SHARED}:/shared basho/riak-kv
CNODE=`docker inspect -f '{{.NetworkSettings.IPAddress}}' riak1`
if [ -z ${CNODE} ]

Sendgrid Cluster Metadata testing steps

Tested on 2.2.0. $RIAK=http://localhost:8098

  1. Create a 5 node cluster in Docker using createdrc.sh
  2. Create a bucket type for Solr without an index with:
docker exec riak1 riak-admin bucket-type create solr '{"props”:{ “w”: 1 }}’
docker exec riak1 riak-admin bucket-type activate solr
CREATE TABLE Sample
(
state varchar not null,
city varchar not null,
time TIMESTAMP not null,
random sint64 not null,
primary key (
(state, city, quantum(time, 15, 'm')),
state, city, time
)
@smarj
smarj / where3.erl
Created March 16, 2017 21:56
Functional Programming in Erlang, 2.15
-module(where3).
-export([palindrome/1]).
palindrome(List) ->
real_palindrome(lcase(strip(List))).
real_palindrome([]) ->
true;
real_palindrome([_X|[]]) ->
true;
@smarj
smarj / w2a2.erl
Created March 15, 2017 17:11
Functional Programming in Erlang, Week 2, Assignment 2
-module(w2a2).
-export([double/1, evens/1]).
double([]) -> [];
double([X|Xs]) ->
[2 * X|double(Xs)].
evens([]) -> [];
evens([X|Xs]) ->
case X rem 2 of
@smarj
smarj / w2a1.erl
Created March 11, 2017 19:04
Functional Programming in Erlange 2.6
-module(w2a1).
-export([maximum/1,
product/1,
tail_maximum/1,
tail_product/1]).
product([]) -> 1;
product([Num|Nums]) -> Num * product(Nums).
tail_product(Nums) -> tail_product(Nums, 1).
@smarj
smarj / one_24.erl
Created March 5, 2017 23:04
Functional Programming in Erlang, assignment 1.24 2017-03-05
-module(one_24).
-export([bits/1, enclose/1, perimeter/1, tail_bits/1]).
%% perimeter/1 - calculate the perimeter of common shapes
%% circle - πD, unrelated to coordinates
perimeter({circle, {_X,_Y}, Radius}) ->
Radius * 2 * math:pi();
%% rectangle - assumes coordinate 1 is lower left, coordinate 2 is upper
%% right, clauses with guards could be used to ensure it
perimeter({rectangle, {X1,Y1}, {X2,Y2}}) ->