Skip to content

Instantly share code, notes, and snippets.

@jeffweiss
jeffweiss / address-validation.patch
Created August 6, 2014 17:09
AvaTax Address Validation Documentation Patch
--- address-validation.orig 2014-08-06 10:04:30.000000000 -0700
+++ address-validation 2014-08-06 10:04:46.000000000 -0700
@@ -465,7 +465,7 @@
<p>For production accounts:</p>
<pre class="qoate-code">https://avatax.avalara.net/1.0/address/validate?Line1=PO+Box+123&amp;City=Bainbridge%20Island&amp;Region=WA&amp;PostalCode=98110</pre>
<p>For development accounts:</p>
-<pre class="qoate-code">https://avatax.avalara.net/1.0/address/validate?Line1=PO+Box+123&amp;City=Bainbridge%20Island&amp;Region=WA&amp;PostalCode=98110</pre>
+<pre class="qoate-code">https://development.avalara.net/1.0/address/validate?Line1=PO+Box+123&amp;City=Bainbridge%20Island&amp;Region=WA&amp;PostalCode=98110</pre>
<p>Sample Response Headers (when an error occurs)</p>
<pre class="qoate-code">HTTP/1.1 500 Internal Server Error Date: Thu, 01 Mar 2012 00:24:54 GMT
@jeffweiss
jeffweiss / layout.erb
Created August 15, 2014 20:03
For the ruby learning group
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<!-- Optional theme -->
@jeffweiss
jeffweiss / Topics
Last active August 29, 2015 14:05
Elixir Demo
1. Clustering
a. Interaction w/ running code without having code
b. Remote process spawning
c. std in/out redirect
2. Supervision Trees
3. Live Code Update
@jeffweiss
jeffweiss / basic_bench.exs
Last active August 29, 2015 14:20
Numbers to words
defmodule BasicBench do
use Benchfella
@num :random.uniform(999_999_999_999)
bench "interpolation" do
@num
|> NumToWordsString.say
end
@jeffweiss
jeffweiss / post_message.lua
Created October 4, 2015 02:26
Sending POSTs to Elixir Phoenix using wrk or wrk2
wrk.method = "POST"
-- this assumes that we're sending to a html form endpoint with csrf protection disabled
-- wrk.body and wrk.headers would be different if we were sending a JSON payload to a JSON API endpoing
wrk.body = "message[body]=wat"
wrk.headers["Content-Type"] = "application/x-www-form-urlencoded"
@jeffweiss
jeffweiss / mix.exs
Last active December 18, 2018 23:13
Retrieving application version number in mix.exs from git describe
defmodule MyApp.Mixfile do
use Mix.Project
def project do
[app: :my_app,
version: get_version,
elixir: "~> 1.0",
elixirc_paths: elixirc_paths(Mix.env),
compilers: Mix.compilers,
build_embedded: Mix.env == :prod,
@jeffweiss
jeffweiss / x10.ex
Created November 4, 2015 22:45
Sample X10 packet (de)composition in Elixir
defmodule X10 do
# all codes referenced from http://www.haibrain.com/informatie-domotica-x10-protocol-c-131_148_141.html?language=en
@house_codes %{
6 => :house_a,
14 => :house_b,
2 => :house_c,
10 => :house_d,
1 => :house_e,
9 => :house_f,
@jeffweiss
jeffweiss / eldap.exs
Created November 9, 2015 19:30
sample of using eldap from elixir
:application.ensure_all_started(:ssl)
{:ok, handle} = :eldap.open(['ldap.example.com'], [{:port, 636}, {:ssl, true}])
authenticated =
:ok == :eldap.simple_bind(handle,
'uid=jeff,ou=users,dc=example,dc=com',
'notmyrealpassword')
{:ok, {:eldap_search_result, list_of_entries, _}} =
@jeffweiss
jeffweiss / emit_log.exs
Last active June 29, 2022 21:02
RabbitMQ Tutorial - Elixir examples
{:ok, connection} = AMQP.Connection.open
{:ok, channel} = AMQP.Channel.open(connection)
message = Enum.join(System.argv, " ") || "Hello World!"
AMQP.Exchange.declare(channel, "logs", :fanout)
AMQP.Basic.publish(channel, "logs", "", message)
IO.puts " [x] Sent '#{message}'"
@jeffweiss
jeffweiss / channels.conf
Created February 23, 2016 17:34
ohaibot channels.conf example
[<<"#ohaibot-testing">>].
[<<"#elixirconf">>].