Łukasz Lach, Docker Captain | 2022
https://lach.dev/ | https://github.com/lukaszlach/
Docker Masters | http://dockermasters.pl/
$ brew install dnsmasq
...
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
/usr/local/etc/dnsmasq.conf
address=/local/127.0.0.1
#!/usr/bin/env ruby | |
require "socket" | |
# This is a simple preloader for Ruby apps. | |
# Usage: | |
# Put this file somewhere in your PATH, named 'ruby_preloader' and make sure | |
# it's executable. | |
# Add whatever you need to load your app environment to a .preload.rb in the | |
# base directory of your project. | |
# Add #!/usr/bin/env ruby_preload as the first line of any script you want to |
# http://zookeeper.apache.org/doc/r3.3.4/recipes.html#sc_leaderElection | |
require 'rubygems' | |
require 'bundler/setup' | |
require 'zookeeper' | |
require 'hashie' | |
class ElectionCandidate | |
ROOT_PATH = "/election" | |
NODE_PATH = "candidate_" |
The reason why you might get certificate errors in Ruby 2.0 when talking HTTPS is because there isn't a default certificate bundle that OpenSSL (which was used when building Ruby) trusts.
Update: this problem is solved in edge versions of rbenv and RVM.
$ ruby -rnet/https -e "Net::HTTP.get URI('https://github.com')"
net/http.rb:917:in `connect': SSL_connect returned=1 errno=0 state=SSLv3
read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
You can work around the issue by installing a certificate bundle that you trust. I trust Mozilla and curl.
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
# codec: blocks | |
describe('articles.views.ArticleView'): | |
context('when user has permissions'): | |
it('should add new article'): | |
# some code | |
it('should delete existing article'): |