Skip to content

Instantly share code, notes, and snippets.


Kevin Thompson blackfist

View GitHub Profile
View sd3_traffic.nlogo
blackfist / painted_desert.nlogo
Created Feb 2, 2017
netlogo painted desert challenge
View painted_desert.nlogo
blackfist / termites_kevin.nlogo
Created Feb 2, 2017
netlogo termites picking up any color
View termites_kevin.nlogo
blackfist /
Last active Apr 15, 2016
Elixir event handling -- am I failing at "let it crash?"

I have a genserver that is taking messages from a websocket and passing them to an event handler. The event handler receives a map from the genserver and takes action where appropriate. So for example, in response to a new user create event, the event handler would check if the user's email address comes from a suspicious domain, and if so, take some actions to reduce abuse.

So in event_handler.ex you can see that when a new message comes in for a user create event, I pass the message to UserHandler.handle_suspicious_domain. That function returns the same map which I pass to UserHandler.handle_suspicious_ip. But I'm not sure if that's idomatic since I'm not transforming the map, I'm just passing it from function to function.

Then you can see in user_handler.ex that I take the domain name through a set of transformations and then make a decision. Looking at line 25 you can see that I have a function that does nothing and only exists to prevent a crash. That seems wasteful and

blackfist / mailgun.ex
Last active Apr 3, 2018
Example of using Elixir and HTTPotion to send mail to Mailgun using the api.
View mailgun.ex
defmodule Mailgun do
@doc """
Sends a basic message to an address. Expects a mailgun domain environment
variable (MAILGUN_DOMIAN) and a mailgun api key environment variable
@spec mail(String.t) :: String.t
def mail(toAddress) do
url = "{System.get_env("MAILGUN_DOMAIN")}/messages"
headers = ["User-Agent": "Elixir",
View seeds.db
Book.create(title: "I win", author: "U. Lose")
Book.create(title: "Robots", author: "Anne Droid")
Book.create(title: "Come on in", author: "Doris Open")
Book.create(title: "The Yellow River", author: "I. P. Freely")

New Years Resolutions for 2015

Mandarin Language resolutions

  • Acquire an additional 300 hours of practice, bringing my total to 900 hours.
  • End the year knowing at least 500 simplified characters
  • Finish reading one chinese novel (short)
  • Have at least 1 hour long conversation with an native speaker in each month of 2015

Keybase proof

I hereby claim:

  • I am blackfist on github.
  • I am kev ( on keybase.
  • I have a public key whose fingerprint is A1F2 5046 F79D B2C3 61F6 A9FB 1BF2 F63F BB73 1AFA

To claim this, I am signing this object:

blackfist / extraction.ipynb
Created Dec 15, 2014
Code to extract article text from VCDB
View extraction.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
blackfist / weird_sort.json
Created Aug 31, 2014
When I sort a data frame and plot it the values are properly sorted but the labels are not.
View weird_sort.json
"metadata": {
"name": "",
"signature": "sha256:70ec5770cd4e35c7a408514277aa748a06612e2b2f4441a5efd73e02746d1a6b"
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
"cells": [