Skip to content

Instantly share code, notes, and snippets.

View angrycub's full-sized avatar

Charlie Voiselle angrycub

View GitHub Profile
@angrycub
angrycub / Dockerfile
Last active September 14, 2017 21:23
Nomad Job File for http-echo based on Windows Nano Server
FROM microsoft/nanoserver
ENV HTTP_ECHO_DOWNLOAD_URL "https://github.com/hashicorp/http-echo/releases/download/v0.2.3/http-echo_0.2.3_windows_amd64.zip"
ENV HTTP_ECHO_PORT 8080
ENV HTTP_ECHO_STRING "Hello World"
RUN powershell.exe -Command ; \
$handler = New-Object System.Net.Http.HttpClientHandler ; \
$client = New-Object System.Net.Http.HttpClient($handler) ; \
$client.Timeout = New-Object System.TimeSpan(0,30,0) ; \

HOWTO: Clean Up Nomad Data Directory

Issue

When attempting to remove all of the data in the Nomad data directory, several directories and files are unable to be deleted. Many messages are logged to the console like:

rm: cannot remove ‘alloc/736f61b9-d7dc-cb73-0dd1-76b1b2ba032d/nomad-ui/secrets’: Device or resource busy
rm: cannot remove ‘alloc/ddcf5a78-5497-f4a4-a101-221fc4e0180b/fabio/alloc’: Device or resource busy
rm: cannot remove ‘alloc/ddcf5a78-5497-f4a4-a101-221fc4e0180b/fabio/secrets’: Device or resource busy

Job Anti-Affinity in Action

Overview

This guide will walk you through creating and executing a job that will demonstrate Nomad's job anti-affinity rules and, in clusters with memory limited Nomad clients, filtering based resource exhaustion.

Sample Environment

  • One Nomad Server Node
  • Three Nomad Client Nodes
    • 768 MB RAM total (providing 761 MB RAM in nomad node-status -self)
@angrycub
angrycub / pinger.erl
Created May 9, 2017 18:14 — forked from lukebakken/pinger.erl
Ping Riak nodes
-module(pinger).
-export([ping/1,
ping/3,
pinglist/4,
pingall/0,
pingall/1,
pingall/2
]).
@angrycub
angrycub / Build a ring using riak_core_claim_sim
Created October 18, 2016 15:57
This will enable a ring to be created using riak_core_claim_sim. These rings could then be used to bootstrap a cluster without having to do the join steps.
RingSize = 32,
FirstNodeName = 'riak@127.0.0.1',
NewRing = riak_core_claim_sim:run([
{ring, riak_core_ring:fresh(RingSize, FirstNodeName)},
{target_n_val,4},
{wants,{riak_core_claim,wants_claim_v3}},
{choose,{riak_core_claim,choose_claim_v3}},
{cmds, [[
{join, 'riak@127.0.0.2'},
{join, 'riak@127.0.0.3'},
@angrycub
angrycub / BookmarkList.md
Created July 11, 2016 14:37
My Bookmark List. Trying to do a little annotation as well

"Useful" Bookmarks

Work Stuff

Daring Fireball: Markdown Web Dingus

  • URL: http://daringfireball.net/projects/markdown/dingus
  • Description: Useful for converting Markdown syntax to corresponding HTML. Useful for creating Patch Delivery Documents since ZenDesk forums only allows for HTML and the ticket comments only allow rich text using Markdown

to-markdown - an HTML to Markdown converter written in javascript

@angrycub
angrycub / Streaming2iReader.java
Last active October 17, 2017 10:21
Sample code to read through nasty multipart/mixed response to get to individual json chunks,
package com.basho;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import org.apache.wink.common.internal.providers.multipart.MultiPartParser;
%% -------------------------------------------------------------------------
%%
%% leveldb_stat_collector: collect statistics from leveldb internal counters
%% to file
%%
%% Copyright (c) 2016 Basho Technologies, Inc. All Rights Reserved.
%%
%% This file is provided 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
@angrycub
angrycub / all_atoms.erl
Created April 27, 2016 17:51
Interesting Atom Module
-module(all_atoms).
-export([all_atoms/0, node_atoms/0, node_atoms/1]).
atom_by_number(Index) ->
binary_to_term(<<131,75,Index:24>>).
all_atoms() ->
atoms_starting_at(0).
@angrycub
angrycub / README.md
Last active September 21, 2024 19:19
Erlang Supervisor Ghost Child Monitor

Erlang Supervisor Ghost Montior

Applies to:

  • Riak EE clusters with MDC:
    • 1.4.x - all versions
    • 2.0.x - all versions prior to Riak 2.0.7
    • 2.1.x - all version; fixed in 2.2.0

About

This workaround is a mitigation for basho/riak_kv#1178