Skip to content

Instantly share code, notes, and snippets.

View FrendaWinter's full-sized avatar

Frenda FrendaWinter

View GitHub Profile

1. ssh-keygen error while loading shared libraries: msys-crypto-3.dll

# Full error: 
# C:/msys64/usr/bin/ssh-keygen.exe: error while loading shared libraries: msys-crypto-3.dll: cannot open shared object file: No such file or directory

# Solution: Install missing library
pacman -S libopenssl
@FrendaWinter
FrendaWinter / octal_to_decimal.rb
Created November 9, 2023 13:09
Covert octal number to decimal number with Ruby
#!/usr/bin/env ruby
# frozen_string_literal: true
# Usage: ruby octal_to_decimal.rb <octal_number>
# Covert octal number to decimal number
def octal_to_decimal n
exponent = 0
result = 0
n = n.to_s
@FrendaWinter
FrendaWinter / toBool.rb
Last active November 6, 2023 09:41
String to boolean with Ruby
#!/usr/bin/env ruby
def to_b(string)
case string
when /^(true|t|yes|y|1)$/i then true
when /^(false|f|no|n|0)$/i then false
else raise "Cannot convert to boolean: #{string}"
end
end
@FrendaWinter
FrendaWinter / timeConverter.rb
Created November 6, 2023 09:33
Convert between time format with Ruby
#!/usr/bin/env ruby
# frozen_string_literal: true
# This Ruby CLI app for Time conversion
require 'date'
def show_help
puts <<~TEXT
Description: Takes a string with a time representation and outputs a string with a time representation,
@FrendaWinter
FrendaWinter / checkValidCreditCard.rb
Created November 6, 2023 09:22
Check if the creadit card is vaild with Ruby
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'creditcard'
# Usage: checkValidCreditCard.rb [card_number_0] [card_number_1] [card_number_???]
puts "Usage: checkValidCreditCard.rb [card_number_0] [card_number_1] [card_number_???]" if ARGV.empty?
index = 0
while (card_number = ARGV.shift)