Picture of a coffee shop in Vietnam
Vietnam β€οΈ
Picture of a coffee shop in Vietnam
Vietnam β€οΈ
#postgres
opening connection to contribyard.com:443... opened starting SSL for contribyard.com:443... SSL established, protocol: TLSv1.3, cipher: TLS_AES_128_GCM_SHA256 <- "GET / HTTP/1.1\r\nAccept: */*\r\nUser-Agent: rest-client/2.1.0 (linux-musl aarch64) ruby/3.2.2p53\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nHost: contribyard.com\r\nSentry-Trace: a8df53e1f85e417681272b1fe4e2678c-c292d42aab79473e\r\nBaggage: sentry-trace_id=a8df53e1f85e417681272b1fe4e2678c,sentry-environment=development,sentry-public_key=1cb040bd5059447083ac5b57ddb9bf70\r\n\r\n" -> "HTTP/1.1 308 Permanent Redirect\r\n" -> "Cache-Control: public, max-age=0, must-revalidate\r\n" -> "Content-Type: text/plain\r\n" -> "Date: Tue, 15 Oct 2024 17:53:38 GMT\r\n" -> "Location: https://www.contribyard.com/\r\n" -> "Refresh: 0;url=https://www.contribyard.com/\r\n" -> "Server: Vercel\r\n" -> "Strict-Transport-Security: max-age=63072000\r\n" -> "X-Vercel-Id: gru1::gltvf-1729014818395-5862adb870d4\r\n" -> "Transfer-Encoding: chunked\r\n" -> "\r\n" -> "f\r\n" reading 15 bytes... -> "Redirecting...\n" read 15 bytes reading 2 bytes... -> "\r\n" read 2 bytes -> "0\r\n" -> "\r\n" Conn keep-alive RestClient::PermanentRedirect: 308 Permanent Redirect from /usr/local/bundle/gems/rest-client-2.1.0/lib/restclient/abstract_response.rb:249:in `exception_with_response'
See in action.
require 'net/http' module Net class HTTP alias_method :initialize_without_timeout, :initialize def self.enable_debug! # raise "You don't want to do this in anything but development mode!" unless Rails.env == 'development' class << self alias_method :__new__, :new def new(*args, &blk) instance = __new__(*args, &blk) instance.set_debug_output($stderr) instance end end end def self.disable_debug! class << self alias_method :new, :__new__ remove_method :__new__ end end end end Net::HTTP.enable_debug!
Old trick for debugging outgoing requests in #Ruby. It's especially useful when you need to ensure that you're sending requests correctly to third parties by showing them the raw request structure.
#Rails
Instead of locking #Ruby in both .ruby-version and the Gemfile, you can read .ruby-version directly in the Gemfile:
ruby file: ".ruby-version"
#Rails
Too many memories
app: tty: true stdin_open: true
To debug a #Rails app in #Docker with #Pry, set stdin_open: true & tty: true in docker-compose.yml. Then, add binding.pry in your code and run docker attach <container_name> to interact with Pry in the container. #Rails #Docker #Debugging
Friday
#Heroku glory days & #Postgres vs the world, w/ Craig Kerstiens
www.youtube.com/watch?v=HMJk...
Screenshot do aplicativo buscar, mostrando os itens rastreados com AirTag
Roupas e Nada lΓquido
Uma coisa que penso tbm, se a minha mala for extraviada ( eu consigo sobreviver com isso aqui)
TambΓ©m meto AirTag em tudo para garantir
Small adjustments:
require 'sidekiq/api'
queue_name = 'low'
queue = Sidekiq::Queue.new(queue_name)
queue.each_with_object(Hash.new(0)) do |item, memo|
memo[item['wrapped'] || item.item['class']] += 1
end
#Sidekiq
Thos is a screenshot from a GitHub issue page under the repository golang/go. The issue is titled βencoding/json: unexpected json.Unmarshal behavior with mapsβ and was opened on October 17, 2015. It includes a discussion about the behavior of the json.Unmarshal function in Go when unmarshaling JSON objects into a map. The user βnsoufrβ initiated the issue and provided a description along with code examples illustrating how the unmarshaling behaves differently from what the Go documentation describes. They point out an inconsistency with the map being replaced by an empty map before key-value pairs are added, which doesnβt align with the documentation. The discussion in the comments section seems to revolve around clarifying this behavior and possibly updating the documentation to reflect what actually occurs in the code
The day I found an issue in the #Golang standard library.
github.com/golang/go/is...
Me :)
Zero-downtime #Postgres schema migrations need this: lock_timeout and retries
postgres.ai/blog/2021092...
Mais importante que ego e parecer super-star, Γ© ter um time ΓΊnico com ΓΊnico foco em resolver problemas.
sempre escolha:
Resolver problema ao invΓ©s de Ganhar discussΓ£o.
#BolhaDev
#CarreiraDev
Afinal de contas, o time que estΓ‘ lΓ‘ foi responsΓ‘vel pelo crescimento da empresa atΓ© agora. JΓ‘ passei por situaΓ§Γ΅es no passado em que alguΓ©m entrava na empresa e dizia: βNa minha empresa anterior era assimβ, mas nunca apresentava um caminho claro.
#CarreiraDev
#BolhaDev
Trabalhei em uma empresa por 10 anos, lΓ‘ era Principal Engineer. Agora, fui para uma empresa bem menor, bem no comeΓ§o da jornada.
Acho que a melhor dica que eu poderia dar nesse caso Γ© nΓ£o ser um cara chato, que chega e aponta que tudo estΓ‘ errado e que nada funciona.
#CarreiraDev
#BolhaDev
require 'sidekiq/api' queue_name = 'low' queue = Sidekiq::Queue.new(queue_name) queue.each_with_object(Hash.new(0)) do |item, memo| memo[item['wrapped']] += 1 puts memo end { "ArtifactIndexerJob" => 817, "FieldJob" => 183, "WebhookJob" => 19435, "EmbeddingsJob" => 122, "UpdaterJob" => 526280, "EventCacheWarmupJob" => 140 }
Counting how many items the queue has per #Sidekiq Job.
#ActiveJob #Rails
$ docker-compose build \ --build-arg CONTRIBSYS_GEM_SERVER_USERNAME=$(op read "op://Shared/Sidekiq Pro - Contribsys/username") \ --build-arg CONTRIBSYS_GEM_SERVER_PASSWORD=$(op read "op://Shared/Sidekiq Pro - Contribsys/password")
This is how you build an image with credentials from a #1Password shared vault.
In this example, I'm passing the #Sidekiq private gem server credentials to be used on the image-building process for a #Rails application.
More info:
developer.1password.com/docs/cli/sec...
Tudo isso levando em consideraΓ§Γ£o que vocΓͺ nΓ£o conseguiu chamar alguΓ©m que entende dessa parte para um pair
Nessa situaΓ§Γ΅es o que mais funciona Γ© quebrar o problema em partes menores, ex:
Tenta reduzir o escopo da olhando apenas para a parte do cΓ³digo que serΓ‘ afetada pela sua modificaΓ§Γ£o, nΓ£o necessariamente precisar entender o todo.
Escrever testes/ou ler os testes para essa Γ‘rea do software.
engraΓ§ado que tudo isso ai eu gosto muito heheh, nao sabia que a galera falava mal heheh.
Win 98 :)
How to Monitor and Fix #Postgres Database Locks in #Rails
pawelurbanek.com/rails-postgr...
Scaling #Rails & #Postgres to Millions of Users at Microsoft: Lessons & Takeaways
stepchange.work/blog/scaling...
curl --request POST \ --variable studyId=$studyId \ --expand-url https://api.host.co/studies/{{studyId}}/candidates \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer xxxxxxx' \ --data @payload.json
Passing variables to the middle of URLs using #cURL
set = Sidekiq::RetrySet.new items = set.each do |item| item.delete if item.klass == "MyHeavyJob" end; nil
How to remove #Sidekiq jobs from retry set by class name:
copy π
Sidekiq::Client.push_bulk(
'class' => SomeJob,
'args' => array_of_args
)