This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'openssl' | |
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~ | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew analytics off | |
brew doctor | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
\curl -sSL https://get.rvm.io | bash -s stable | |
source /Users/edgarortega/.rvm/scripts/rvm | |
type rvm | head -1 | |
rvm -v | |
brew install git node vim postgres tmux yarn ag |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_memory_usage | |
memory_before = `ps -o rss= -p #{Process.pid}`.to_i | |
yield | |
memory_after = `ps -o rss= -p #{Process.pid}`.to_i | |
puts "Memory: #{((memory_after - memory_before) / 1024.0).round(2)} MB" | |
end | |
def print_time_spent | |
time = Benchmark.realtime do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir ~/java10 | |
cd ~/java10 | |
wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/10+46/76eac37278c24557a3c4199677f19b62/jdk-10_linux-x64_bin.tar.gz | |
tar -zxvf jdk-10_linux-x64_bin.tar.gz | |
cd jdk-10/ | |
update-alternatives --install /usr/bin/java java ~/java10/jdk-10/bin/java 100 | |
update-alternatives --config java | |
update-alternatives --install /usr/bin/javac javac ~/java10/jdk-10/bin/java 100 | |
update-alternatives --config javac | |
update-alternatives --install /usr/bin/jar jar ~/java10/jdk-10/bin/jar 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Package libssl was not found in the pkg-config search path. | |
# Perhaps you should add the directory containing `libssl.pc' | |
# to the PKG_CONFIG_PATH environment variable | |
# No package 'libssl' found | |
# Package libcrypto was not found in the pkg-config search path. | |
# Perhaps you should add the directory containing `libcrypto.pc' | |
# to the PKG_CONFIG_PATH environment variable | |
# No package 'libcrypto' found | |
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "net/http" | |
class FileDownloader | |
attr_reader :uri, :http_response | |
HTTPS_SCHEME = "https" | |
def initialize(url:, target:) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget https://www.sqlite.org/2018/sqlite-autoconf-3240000.tar.gz | |
tar xvfz sqlite-autoconf-3240000.tar.gz | |
cd sqlite-autoconf-3240000 | |
./configure | |
make | |
make install # you may need sudo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "zlib" | |
open_mode = "ab" # append / binary | |
file = File.open('path-to-file.csv.gz', open_mode) | |
gz = Zlib::GzipWriter.new(file) | |
gz.write("new,row,csv\n") | |
gz.close | |
# http://ruby-doc.org/core-2.5.3/IO.html#method-c-new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ bin/rails c | |
Loading development environment (Rails 5.2.3) | |
2.6.2 :001 > class Profile < ApplicationRecord | |
2.6.2 :002?> has_many :persons, inverse_of: :profile, dependent: :destroy | |
2.6.2 :003?> has_many :foos, :through => :persons | |
2.6.2 :005?> accepts_nested_attributes_for :persons | |
2.6.2 :006?> end | |
=> [:persons] | |
2.6.2 :007 > class Person < ApplicationRecord | |
2.6.2 :008?> has_one :foo, inverse_of: :person, dependent: :destroy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Be iMproved | |
set nocompatible | |
let g:ale_completion_enabled = 0 | |
" ALE - some of the options need to be defined before ALE is initialized | |
let g:ale_echo_cursor = 1 | |
let g:ale_close_preview_on_insert = 1 | |
let g:ale_set_balloons = 1 | |
let g:ale_sign_column_always = 1 |