Skip to content

Instantly share code, notes, and snippets.

@jmnsf
jmnsf / .bash_profile
Last active September 15, 2020 18:08
Dev box config files
alias ll='ls -lhG'
alias cp='cp -irv'
alias mv='mv -iv'
alias rm='rm -ir'
alias jspec="RAILS_ENV=test bundle exec rake spec:javascript"
alias http="ruby -run -ehttpd . -p8000"
alias dockerclean="docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs docker rm"
alias gitclean="git branch --merged | ack '^(?![\* ] master).+$' | xargs git branch -d"
alias nodev="node -r ./scripts/dev.js"
alias tunnel="forever ssh -vND 1080 -p 443 root@proxy.jmnsf.com"
@jmnsf
jmnsf / dynamic_supervisor.exs
Created February 26, 2021 13:58
DynamicSupervisor: always creating a child vs checking first benchmark
import ExUnit.Assertions
defmodule TestChild do
use GenServer
def start_link(child_id) do
GenServer.start_link(__MODULE__, child_id, name: {:via, Registry, {TestRegistry, child_id}})
end
@impl true
@jmnsf
jmnsf / ssh-tunnel-setup.md
Created April 21, 2017 04:55
SSH Tunnel Setup

SSH Tunnel Setup

Use this for protected networks where port 22 isn't available, or for general security reasons where your traffic will be routed through an external server via SSH tunnel.

Server Setup

An EC2 micro instance or a tiny DigitalOcean droplet will work for this. For the initial configuration, access to port 22 is required, as you'll have to SSH onto your host.

In the host, edit /etc/ssh/sshd_config and add the line Port 443. Reboot. From now on you can SSH into the server through port 443 (ssh -p 443 user@server).

Tunnel Setup