rbenv install 2.7.1
Downloading ruby-2.7.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.1.tar.bz2
Installing ruby-2.7.1...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 12.4 using ruby-build 20220713)
This file contains 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
// create file: | |
sudo vim /usr/share/applications/intellij.desktop | |
// add the following | |
[Desktop Entry] | |
Version=13.0 | |
Type=Application | |
Terminal=false | |
Icon[en_US]=/home/rob/.intellij-13/bin/idea.png | |
Name[en_US]=IntelliJ |
This file contains 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
# Basic example | |
siege -t60s -c20 -d10 'http://robertomurray.co.uk/' | |
# Basic auth; | |
auth=$(echo -n 'username:password' | openssl base64) | |
siege -t60s -c20 -d10 --header="Authorization:Basic $auth" 'https://staging.a-hostname.co.uk/' |
This file contains 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
/^((AC|ZC|FC|GE|LP|OC|SE|SA|SZ|SF|GS|SL|SO|SC|ES|NA|NZ|NF|GN|NL|NC|R0|NI|EN|\d{2}|SG|FE)\d{5}(\d|C|R))|((RS|SO)\d{3}(\d{3}|\d{2}[WSRCZF]|\d(FI|RS|SA|IP|US|EN|AS)|CUS))|((NI|SL)\d{5}[\dA])|(OC(([\dP]{5}[CWERTB])|([\dP]{4}(OC|CU))))$/ |
This file contains 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
columns_that_make_record_distinct = [:some_id, :another_name] | |
distinct_ids = Model.select("MIN(id) as id").group(columns_that_make_record_distinct).map(&:id) | |
duplicate_records = Model.where.not(id: distinct_ids) |
This file contains 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
SELECT sub.ip FROM | |
(SELECT set_masklen(((generate_series(1, | |
(2 ^ (32 - masklen('10.10.100.0/24'::cidr)))::integer - 2) + | |
'10.10.100.0/24'::cidr)::inet), 32) as ip) AS sub | |
WHERE sub.ip NOT IN | |
(SELECT ip_address from ip_table) | |
AND sub.ip > set_masklen('10.10.100.0/24', 32)+10 | |
AND sub.ip < set_masklen(broadcast('10.10.100.0/24')::inet, 32)-5; |
This file contains 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 'net/http' | |
require 'benchmark' | |
def make_request(sleep_mins, read_timeout = 1) | |
puts "sleep_mins=#{sleep_mins} mins read_timeout=#{read_timeout} mins" | |
uri = URI.parse 'http://localhost:4040' | |
request = Net::HTTP::Get.new("/sleep?m=#{sleep_mins}") | |
Net::HTTP.start(uri.host, uri.port, read_timeout: (read_timeout * 60)) do |http| |
This file contains 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
RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" asdf install ruby 2.6.5 |
This file contains 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
begin | |
require 'awesome_print' | |
AwesomePrint.irb! | |
rescue LoadError | |
Gem.install('awesome_print') | |
retry | |
end | |
ap '👋🌎' |
This file contains 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
namespace :export do | |
desc <<-DESC.strip_heredoc | |
Export tables listed as YAML | |
Usage: `rails export:tables TABLES=users,posts,comments` | |
DESC | |
task tables: :environment do | |
models = ENV["TABLES"].split(",").map do |name| | |
name.to_s.classify.constantize | |
rescue NameError | |
nil |
NewerOlder