Skip to content

Instantly share code, notes, and snippets.

View FrendaWinter's full-sized avatar

Frenda FrendaWinter

View GitHub Profile
@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)
@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 / 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 / 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

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 / downloadAndInstall.cpp
Last active May 3, 2024 07:33
Download MSi file and install it (Replace the code with correct URL and silent install param, run as administrator if needed)
#include <iostream>
#include <windows.h>
#include <urlmon.h>
#pragma comment(lib, "urlmon.lib")
int main()
{
std::string downloadUrl = "https://www.uvnc.eu/download/1400/UltraVnc_1409_X64.msi"; // Replace with the actual download URL
std::string filePath = "D:\\Download\\UltraVnc_1409_X64.msi"; // Replace with the desired download path
@FrendaWinter
FrendaWinter / ruby2d_errors.md
Last active March 5, 2024 17:30
Install ruby2d error with msys2

Open Msys2 shell

pacman -Syu

1. make error

pacman -S make

2. undefined reference to __intrinsic_setjmpex

pacman -S mingw-w64-ucrt-x86_64-SDL2_mixer

3. Collect2.exe error ld.exe return 37 exit code

@FrendaWinter
FrendaWinter / Note.md
Created April 2, 2024 10:41
Python testcontainers note

Install package

pip install testcontainers

Start docker

sudo systemctl status docker

sudo systemctl start docker

@FrendaWinter
FrendaWinter / Nitro.md
Created May 3, 2024 07:53
Nitro Pro slient installation with language option
@FrendaWinter
FrendaWinter / DotNetOnWin7.md
Created May 15, 2024 08:01
Install .Net 4.7.2 on Windows 7