This sheet goes along with this SSH YouTube tutorial
$ ssh brad@192.168.1.29
$ mkdir test
$ cd test
sudo wireshark | |
# go to: | |
# Edit -> Preferences -> Protocols -> TLS (you can type) -> under "(Pre)-Master-Secret log filename | |
" enter in input "/tmp/ssl-key.log" | |
# then start capture | |
# curl | |
SSLKEYLOGFILE=/tmp/ssl-key.log curl https://example.com | |
# firefox (don't forget to disable http2 in about:config and restart) |
$ ssh brad@192.168.1.29
$ mkdir test
$ cd test
This guide is targetted at intermediate or expert users who want low-level control over their Python environments.
When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. This helps keep each workflow in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. The guide here covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda
). See the Using the workflow section to view the end result.
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1 | |
# --no-check-cerftificate was necessary for me to have wget not puke about https | |
curl -LJO https://github.com/joyent/node/tarball/v0.7.1 |
# Formats a +number+ into an abbreviated string suitable for | |
# displaying social media type metrics | |
# | |
# ==== Options | |
# * start_at - The first number to start abbreviating, defaults | |
# to 10_000. Certain metrics may want to start at e.g. 1000. | |
# | |
# ==== Examples | |
# number_to_social(123) # => 123 | |
# number_to_social(1457) # => 1457 |
class SessionsController < ApplicationController | |
def create | |
ToDoList::SignIn.new(sign_in_params).call({ | |
success: ->(message) { redirect_to dashboard_user_path, notice: t(message) }, | |
failure: ->(message) { render :new, error: t(message) } | |
}) | |
end | |
end | |
module ToDoList |
git remote add upstream https://github.com/whoever/whatever.git
git fetch upstream
This is a collection of links, examples and rants about Presenters/Decorators in Rails.
The "Decorator" pattern slowly started gaining popularity in Rails several years ago. It is not part of core Rails, and there's many different interpretations about how it should work in practice.
Jay Fields wrote about it in 2007 (before he switched back to Java and then Clojure): http://blog.jayfields.com/2007/03/rails-presenter-pattern.html
#!/usr/bin/env bash | |
# | |
# drip_ssh_proxy.sh | |
# | |
# Attempts to pull private ip address from hostname pattern. | |
# assumes ruby is present on the system. | |
HOST_PORT="$1" | |
if [[ -z "$HOST_PORT" ]]; then | |
>&2 echo "host:port is required" |
By default, Rails applications build URLs based on the primary key -- the id
column from the database. Imagine we have a Person
model and associated controller. We have a person record for Bob Martin
that has id
number 6
. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6
here, is called the "slug". Let's look at a few ways to implement better slugs.