Skip to content

Instantly share code, notes, and snippets.

View tmjoen's full-sized avatar
🔥

T. Mjoen tmjoen

🔥
  • Bielke&Yang
  • Oslo, Norway
View GitHub Profile
# ssh to remote

localhost$ ssh -p 30000 my_app@diamond

my_app@my_app.com$ epmd -names
epmd: up and running on port 4369 with data:
name my_app at port 43108
my_app@my_app.com$ exit
@tmjoen
tmjoen / webfonts.nginxconf
Created November 2, 2016 17:40
NGINX webfont protection from hotlinking
location ~ \.(eot|svg|ttf|woff|otf)$ {
valid_referers blocked mysite.com *.mysite.com;
if ($invalid_referer) {
return 403;
}
}
# in your app supervisor
:phx_dyn_dispatch = :ets.new(:phx_dyn_dispatch, [:named_table, :bag, :public])
defmodule DynamicDispatch do
def register(group, plug, opts) do
true = :ets.insert(:phx_dyn_dispatch, {group, plug, opts})
end
def unregister(group, plug) do
~/sql ❯❯❯ createdb -T template0 db_name ⏎
~/sql ❯❯❯ pg_restore -C -d db_name db_name.custom