Skip to content

Instantly share code, notes, and snippets.

View denvera's full-sized avatar

Denver A denvera

View GitHub Profile
@denvera
denvera / elixir_amqp_headers.ex
Created March 6, 2018 10:05
Parse out death count and queue from Elixir AMQP headers
# headers from headers: key of meta parameter to consumer function
# Returns {death_count, last_queue_name}
def get_death_info([headers: headers] = h) do
x_death_tables = Enum.find(headers, fn e ->
elem(e, 0) == "x-death"
end) |> elem(2)
{deaths, last_queue} = Enum.reduce(x_death_tables, {0, ""}, fn {:table, attrs} = e, acc ->
IO.puts(inspect(attrs))
in_acc = Enum.reduce(attrs, {0, ""}, fn e, acc ->
@denvera
denvera / das.py
Last active April 9, 2018 16:35
Download all screencasts currently free (until 10-4-2018) from www.destroyallsoftware.com
#!/usr/bin/python
# Download all screencasts currently free (until 10-4-2018) from www.destroyallsoftware.com
# Update to set User-Agent
from bs4 import BeautifulSoup
import os
import requests
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
}