Skip to content

Instantly share code, notes, and snippets.

View covard's full-sized avatar
💾

Curtis Ovard covard

💾
  • Salt Lake City, Utah
View GitHub Profile
@covard
covard / setupterm_terminfo_database.md
Created April 2, 2024 19:34
rails command throwing setupterm , terminfo database not found error

If you get the below error when running a rails command stop spring spring stop

`setupterm': The terminfo database could not be found. (Reline::Terminfo::TerminfoError)
@covard
covard / array_dup_count.md
Created February 3, 2023 15:59
Get count of array items. i.e. looking for duplicates in array
 ```
h = Hash.new(0)
['a','b','b','c'].each{ |e| h[e] += 1 }
=>
{ a: 1, b: 2, c: 1 }
@covard
covard / sidekiq_dead_set_cleanup.md
Created January 12, 2023 21:21
Sidekiq dead queue cleanup by date. Sidekiq dead queue created_at to actual date.

Sidekiq Dead Queue / Set

The sidekiq dead queue object has a an item['created_at'] that is an decimal (of unknown meaning is it julian? is it seconds is it a unix time stamp?) However on the object there is a method for created_at that will return a Date object.

ds = Sidekiq::DeadSet.new
size = ds.size
ds.each_with_index do |job- indx|
 print "\r #{indx} of #{size}"
@covard
covard / gitsh_color.md
Created December 23, 2022 17:22
How to set the thoughtbot git shell or gitsh prompt color.

To set the color of your prompt edit your ~/.gitconfig file and add the below (with your color choices) at the bottom.

[gitsh "color"]
  default = magenta
  untracked = yellow
  modified = red
@covard
covard / openssl_eventmachine.md
Created December 6, 2022 16:24
OpenSSL Eventmachine gem install issue

If getting an error with installing eventmachine (openssl issue) you can get it installed by using the below.

PKG_CONFIG_PATH="$(brew --prefix [email protected])/lib/pkgconfig" gem install eventmachine -v '1.2.7'
@covard
covard / time_in_zone.md
Last active October 28, 2022 17:57
Get time in specified time zone ruby/rails

Time In Zone

Time.now.in_zone('America/Denver')

Zone Mappings

@covard
covard / mysql_convert_time_zone.md
Created June 14, 2022 19:21
A reminder on how to convert time in mysql, i.e. a job starts at 10pm mountain time what time is that UTC?

MySQL

Convert Time Zone

select convert_tz('2022-06-14 22:00:00', 'US/Mountain', 'UTC');

2022-06-15 05:00:00
@covard
covard / rails_assets_info.md
Created June 8, 2022 17:50
How to get the md5 hash part of an assets file name

Rails Assets Info

Get the asset file name including the MD5 Hash

Rails.application.assets.find_asset('some_logo_new.png').digest_path
=> "some_logo_new-65fba08ccabccb7ece3304b5b80596a26624018a41222478a9bdeab9b06e701f.png"
@covard
covard / homebrew_info.md
Last active May 18, 2022 18:01
Homebrew Info

Homebrew Info Homebrew Logo

Curl

You can no longer link or link --force for curl. To be able to use the brew install curl.

You will get the following message.

@covard
covard / openssl.md
Created May 18, 2022 17:28
Openssl Server Cert handshake checker

OpenSSL

how to check server cert

$ openssl s_client -connect clover.mydomain.com:443

CONNECTED(00000007)
depth=0 CN = *.mydomain.com
verify error:num=20:unable to get local issuer certificate