Skip to content

Instantly share code, notes, and snippets.

View BenMorganIO's full-sized avatar
😀
Why is this here?

Ben A. Morgan BenMorganIO

😀
Why is this here?
View GitHub Profile

Keybase proof

I hereby claim:

  • I am benmorganio on github.
  • I am benmorganio (https://keybase.io/benmorganio) on keybase.
  • I have a public key ASDA1Wv9C_-wtRiM6dvNYCaowXCKtbJAQKWYN6YYYozJjwo

To claim this, I am signing this object:

defmodule Test do
def migrations_for(migration_source) when is_binary(migration_source) do
query = Path.join(migration_source, "*")
for entry <- Path.wildcard(query),
info = extract_migration_info(entry),
do: info
end
defp extract_migration_info(file) do
# Hey everyone,
#
# So, my name's Ben and tonight, I'll be talking about Dialyzer and what you can
# do with it.
#
center <<-EOS
\e[1mDiscovering Dialyzer\e[0m
Ben A. Morgan
@BenMorganIO
BenMorganIO / geth
Created June 4, 2017 21:10
Geth init.d script
#! /bin/sh
### BEGIN INIT INFO
# Provides: geth
# Required-Start: $local_fs $remote_fs
# Required-Stop:
# X-Start-Before: rmnologin
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Ethereum Mining
defmodule Ryal.PaymentMethod do
schema "ryal_payment_methods" do
field :type, :string
embeds_one :data, modularize_field(:type) # :p
end
end
# or, can I do:
schema "ryal_payment_methods" do
$ mix ryal.install
==> ryal_core
Compiling 1 file (.ex)
** (UndefinedFunctionError) function App.Repo.config/0 is undefined (module App.Repo is not available)
App.Repo.config()
lib/mix/ecto.ex:162: Mix.Ecto.build_repo_priv/1
lib/mix/ecto.ex:148: Mix.Ecto.migrations_path/1
lib/mix/tasks/ryal.core.install.ex:46: Mix.Tasks.Ryal.Core.Install.project_migration_dir/0
lib/mix/tasks/ryal.core.install.ex:9: Mix.Tasks.Ryal.Core.Install.run/1
(mix) lib/mix/task.ex:294: Mix.Task.run_task/3
defmodule Mix.Tasks.Ryal.Core.Install do
@moduledoc "Installs all Ryal Core migrations."
use Mix.Task
def run(_) do
File.mkdir_p project_migration_dir()
stamp = String.to_integer timestamp()
iex(1)> alias RedisPoolex, as: Redis
RedisPoolex
iex(2)> Redis.query ~w(SET hello world)
** (exit) exited in: :gen_server.call(:redis_pool, {:checkout, #Reference<0.0.4.2754>, true}, 5000)
** (EXIT) no process
:erlang.send(:redis_pool, {:"$gen_cast", {:cancel_waiting, #Reference<0.0.4.2754>}}, [:noconnect])
(stdlib) gen_server.erl:416: :gen_server.do_send/2
(stdlib) gen_server.erl:232: :gen_server.do_cast/2
(poolboy) src/poolboy.erl:58: :poolboy.checkout/3
(poolboy) src/poolboy.erl:74: :poolboy.transaction/3
@BenMorganIO
BenMorganIO / fastboot
Created December 7, 2016 22:39
Ember fastboot init.d daemon.
#!/bin/sh
### BEGIN INIT INFO
# Provides: fastboot
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Ember Fastboot server.
# Description: Boots up Ember Fastboot from the /var/web/frontend folder targeting the ./dist directory.
@BenMorganIO
BenMorganIO / 00_nginx_https_rw.config
Created November 14, 2016 02:00
I can't believe this is what it takes to do SSL redirection on AWS EB...
files:
"/tmp/45_nginx_https_rw.sh":
owner: root
group: root
mode: "000644"
content: |
#! /bin/bash
CONFIGURED=`grep -c "return 301 https" /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf`