This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use case | |
DockerShell.start("kroki_service", "yuzutech/kroki", "9001", "8000") do | |
log stick :b, color, "I just think Ruby is the Best for coding!" | |
sleep 10 | |
end | |
__BEGIN__ | |
class MicroSystem::DockerShell < DevSystem::Shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TelegramClient < AppClient | |
def self.bot_token | |
".............................................." | |
end | |
def self.base_url | |
"https://api.telegram.org/bot#{bot_token}" | |
end | |
helper_class :loggable, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PicorubyCommand < DevSystem::SimpleCommand | |
section :filters | |
def before | |
super | |
@t = Time.now | |
log "simple_args #{ simple_args }" | |
log "simple_booleans #{ simple_booleans }" | |
log "simple_strings #{ simple_strings }" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
class MyIcmpSocket | |
ICMP_ECHO_REQUEST_TYPE = 8 | |
ICMP_ECHO_REQUEST_CODE = 0 | |
ICMP_HEADER_SIZE = 8 | |
def initialize | |
@socket = Socket.new(Socket::AF_INET, Socket::SOCK_RAW, Socket::IPPROTO_ICMP) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CalculatorCommand < AppCommand | |
class Error < StandardError; end | |
def self.sum(a, b)= a + b | |
def self.sub(a, b)= a - b | |
def self.mul(a, b)= a * b | |
def self.div(a, b)= a / b | |
def self.call (args) | |
log "Called #{self}.#{__method__} with args #{args}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BookCommand < AppCommand | |
def self.call args | |
log :higher, "Called #{self}.#{__method__} with args #{args}" | |
new(args).call | |
end | |
def initialize args | |
@args = args | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
require 'json' | |
require 'net/http' | |
# https://dog.ceo/dog-api/ | |
class DogCeoAPI | |
def self.get_random_mocked | |
{ | |
"message" => "https://images.dog.ceo/breeds/terrier-welsh/lucy.jpg", | |
"status" => "success" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CpfJames | |
module_function | |
def protect(string) | |
string.split(' ').map { |s| valid?(s) ? mask(s) : s }.join(' ') | |
end | |
def valid?(s) | |
!!s.match(/\d{3}.\d{3}.\d{3}-\d{2}/) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install firmware-b43-installer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Faxtures | |
module_function | |
class Error < StandardError; end | |
class ReadFileNotFound < Error; end | |
# def read(*names, name, &block) | |
# TODO: read file line by line for RAM optimization | |
# end |
NewerOlder