Start a MySQL DB:
docker run -d --name local-mysql -v mysql:/var/lib/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:5.7
Start a PostgresSQL DB:
package fileline | |
import ( | |
"fmt" | |
"os" | |
"runtime" | |
"strings" | |
) | |
//Location returns an absolute path of the caller file and the line number. |
#!/bin/bash | |
# Author: Daniel Alvarenga Lima | |
# Ubuntu version supported: 20.04 LTS amd64 | |
# EXECUTE | |
# sudo chmod +x script-configure-ubuntu18.94-amd64.sh | |
# ./script-configure-ubuntu20.04-amd64.sh | |
#INSTRUCTIONS |
Binary UUIDs are much more efficient in space and lookups compared to VARCHAR or CHAR UUIDs. To better exmplain how they work I have a few examples of raw sql and how that translates in a programming language like Ruby using the UUID tools module. All examples will reference the following database table and schema.
Table name: users
id :uuid(16)
first_name :string(255)
last_name :string(255)
# Simple approach to sending email from the Rails console | |
# Implementation idea courtesy of Steve Klabnik | |
# http://blog.steveklabnik.com/posts/2012-09-09-random-ruby-tricks--class-new | |
# Create the mailer class with a block and assign to a variable | |
mailer = Class.new(ActionMailer::Base) do | |
def example_message | |
mail(to: "test@test.com", from: "test@test.com", subject: "Example Message") do |format| | |
format.text { render text: "Example message body" } | |
end |
#!/usr/bin/env bash | |
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/ | |
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c | |
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver | |
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception | |
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal | |
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04 | |
# Versions | |
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` |
#!/usr/bin/env ruby | |
require 'benchmark' | |
MAX = 100000 | |
results = {} | |
def if_return(attempt) | |
if attempt == 'primeira' | |
return 'primeira' |