Skip to content

Instantly share code, notes, and snippets.

Randѕon rands0n

Block or report user

Report or block rands0n

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rands0n /
Created May 22, 2019 — forked from eladnava/
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
# Make sure to:
# 1) Name this file `` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x
# 7) Test it out via ./
rands0n / authentication.rb
Created Apr 17, 2019 — forked from theCrab/authentication.rb
A Hanami Framework authentication based on JSON Web Tokens.
View authentication.rb
# lib/authentications/authentication.rb
# @api auth
# Authentication base class
module Authentication
def self.included(base)
base.class_eval do
before :authenticate!
expose :current_user
View gist:97f63c6b3703778087288c682990a6ac
git filter-branch --env-filter '
rands0n / Dockerfile
Created Mar 25, 2017
Docker to run ruby
View Dockerfile
FROM ruby:2.3.3
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /app # app name
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
rands0n / .vimrc
Last active Sep 9, 2018
.vimrc config
View .vimrc
" =============================================================================
" Randson Oliveira .vimrc file
" -----------------------------------------------------------------------------
" Heavily inspired by: @millermedeiros, @scrooloose, @nvie, @gf3, @bit-theory.
" -----------------------------------------------------------------------------
" -----------------------------------------------------------------------------
" -----------------------------------------------------------------------------
rands0n /
Created Dec 27, 2016
Install ruby with rbenv
git clone ~/.rbenv
git clone ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
# plugins
git clone ~/.rbenv/plugins/rbenv-gem-rehash
## postgres

i → Insert mode. Type ESC to return to Normal mode.

x → Delete the char under the cursor

:wq → Save and Quit (:w save, :q quit)

dd → Delete (and copy) the current line

p → Paste

View heroku-pg.rake
namespace :db do
desc "Copy production database to local"
task :copy_production => :environment do
# Download latest dump
system("wget -O tmp/latest.dump `heroku pg:backups public-url -q`")
# get user and database name
config = Rails.configuration.database_configuration["development"]
database = config["database"]
user = config["username"]

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault


rands0n /
Created Feb 28, 2016 — forked from devthiago/
Cool shell functions
# WEATHER INFO ------------------------------------------------------------
# Usage:
# $ weather [CITY_NAME]
# Examples:
# $ weather #returns current local weather
# $ weather "Porto Alegre" #returns Porto Alegre weather
function weather {
if [ -z "$1" ]; then
You can’t perform that action at this time.