Skip to content

Instantly share code, notes, and snippets.

On vacation

Oshan Wisumperuma oshanz

On vacation
View GitHub Profile
View worst file
git log --format=format: --name-only | egrep -v '^$' | sort | uniq -c | sort -rg | head -10
oshanz / ruby on
Last active Aug 25, 2020
ruby on fedora
View ruby on

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
View gist:1160fafe8b641c5982229a8f887f4c4a
View hard disk clicking
  • 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 / capistrano.rb
Last active Jul 23, 2020
capistrano clear cache
View capistrano.rb
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"
View Using GDB to inspect a running Ruby

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.

View gist:0cf81ffecc5893e07527e92c4518555d
curl -GET "http://localhost:9200/_cluster/allocation/explain?pretty"
curl -XPOST 'localhost:9200/_cluster/reroute?retry_failed'
View questions
- 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?
You can’t perform that action at this time.