I hereby claim:
- I am dolzenko on github.
- I am dolzenko (https://keybase.io/dolzenko) on keybase.
- I have a public key ASAipUSRr1nXIPSfQHVNeEFTKKf7snq4L8dxWbcm7uQrcAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.
All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.
What do these lines do? Make predictions and then scroll down.
func print(pi *int) { fmt.Println(*pi) }
# Put this file in config/initializers/irb.rb | |
# Works in Rails 3.0+, should also work in 2.3 | |
# Override the IRB, to provide the Rails environment in the prompt | |
module IRB | |
class << self | |
def setup_with_prompt_override(ap_path) | |
setup_without_prompt_override(ap_path) | |
env = (Rails.env.to_sym == :production ? "\033[00;31mPRODUCTION\033[00m" : Rails.env) |
# .irbrc | |
if defined?(Rails) && Rails.production? | |
conf = IRB.conf[:PROMPT][IRB.conf[:PROMPT_MODE]] | |
red = "\033[0;31m" | |
reset = "\033[0m" | |
[:PROMPT_S, :PROMPT_C].each do |p| | |
conf[p].gsub!(/^(.*)$/, "#{red}\\1#{reset}") | |
end | |
conf[:PROMPT_I] = "#{red}%N(%m):%03n:%i (PRODUCTION) > #{reset}" | |
end |
10.240.0.53 mm-1 | |
10.240.0.55 mm-2 | |
10.240.0.56 mm-3 | |
10.240.0.21 ms-1 | |
10.240.0.23 ms-2 | |
10.240.0.29 ms-3 | |
10.240.0.34 ms-4 | |
10.240.0.36 ms-5 | |
10.240.0.31 ms-6 | |
10.240.0.32 ms-7 |
package main | |
import "fmt" | |
func f() (int, error) { | |
return 42, nil | |
} | |
func main() { | |
x := 3 |
require 'json' | |
require 'set' | |
myself = `go list`.strip | |
deps = Set.new | |
`go list ./...`.each_line do |dep| | |
pdeps = JSON.parse(`mgmt go list -json #{dep}`) | |
deps += pdeps['Deps'] | |
deps += pdeps['TestImports'] if pdeps['TestImports'] |
module Acme | |
module Sidekiq | |
module PaperTrailMiddleware | |
class Client | |
# @param [Object] | |
# @param [Hash] job | |
def call(_, job, *) | |
job['whodunnit'] = ::PaperTrail.whodunnit | |
yield | |
end |
ruby -rwebrick -e'WEBrick::HTTPServer.new(Port: 8000, DocumentRoot: Dir.pwd).start' |
module Net | |
class HTTP | |
alias_method '__initialize__', 'initialize' | |
def initialize(*args,&block) | |
__initialize__(*args, &block) | |
ensure | |
@debug_output = $stderr ### if ENV['HTTP_DEBUG'] | |
end | |
end |