Skip to content

Instantly share code, notes, and snippets.

View oshanz's full-sized avatar
🌴
On vacation

Oshan Wisumperuma oshanz

🌴
On vacation
View GitHub Profile
@oshanz
oshanz / ruby on fedora.md
Last active August 25, 2020 13:03
ruby on fedora

for ruby 2.2.10

dnf install compat-openssl10-devel --allowerasing

for ruby 2.6.6

$ openssl version

remove compat-openssl10*

dnf install openssl-devel

https://stackoverflow.com/questions/62256277/geojson-to-elasticsearch-unable-to-tessellate-shape
https://stackoverflow.com/questions/55587629/failed-to-create-valid-geo-shape/55588509#55588509
@oshanz
oshanz / hard disk clicking noice.md
Created August 3, 2020 12:12
hard disk clicking noice
  • check if these values change after sound smartctl -A /dev/sda|grep -E 'Power_Cycle_Count|Load_Cycle_Count'

  • acoustic level sudo hdparm -M /dev/sda /dev/sda: acoustic = 254 (128=quiet ... 254=fast)

  • see current value sudo hdparm -B /dev/sda

@oshanz
oshanz / capistrano.rb
Last active July 23, 2020 12:37
capistrano clear cache
namespace :cachestore do
desc "clear cache store"
task :clear, roles: [:app] do
with rails_env: fetch(:rails_env) do
within current_path do
execute :bundle, :exec, "rake cache:clearstore"
end
end
end
end

http://robots.thoughtbot.com/post/47202759358/using-gdb-to-inspect-a-running-ruby-process

That’s not a great thing to have to say, is it? However, I bet you’ve said it before and may not have immediately know why.

With liberal use of puts and maybe pry, you can figure out what a problem might be next time you run it, but sometimes you need to figure out what that problem is right now.

As it turns out, and I know this is a shocker, Ruby processes are just regular processes. They can be debugged with gdb.

Having recently had the need to find out why a job of mine was running particularly slowly, I found out about this lovely tool the hard way: frantic googling. I found some very useful functions for gdb in a blog post by Rasmus on Ruby callstacks.

curl -GET "http://localhost:9200/_cluster/allocation/explain?pretty"
curl -XPOST 'localhost:9200/_cluster/reroute?retry_failed'
@oshanz
oshanz / questions
Created May 16, 2020 14:40
interview
- What are you hoping I’ll change?
- How does your development process work?
- What tools does your team use to communicate?
- what happened to last person?
- If I’m not meeting expectations, how will I know?
- How will I get better at my job?