- Introduction to the Ruby language
- Basic Tools, IDE, Runtime
- Basic syntax, data types, and control structures
- Modules and classes
- Practical examples of module and class usage
This file contains hidden or 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
# Requires doctl and the "public-ip-cli" npm module to be globally installed. | |
#!/bin/sh | |
FWID="YOUR_FIREWALL_ID" | |
IPV4=$("${HOME}/.nodebrew/current/bin/public-ip" --4) | |
#IPV6=$("${HOME}/.nodebrew/current/bin/public-ip" --6) | |
printf "🔥 Updating DO firewall rules\n\n" | |
OLD_RULES="$(doctl compute firewall get "${FWID}" --format InboundRules | tr ' ' '\n' | grep -E 'ports:22|ports:2022' | tr '\n' ' ' | sed '$ s/.$//')" |
basic CSS template for A4 print
BONUS: includes style for A2 and A5!
A Pen by rafaelcastrocouto on CodePen.
This file contains hidden or 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
ruby -e "require 'rubygems';require 'sinatra';set :port, 9999;set :public, Dir.pwd" |
This file contains hidden or 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
import torch | |
# Use when setting up CUDA in the beginning. | |
# Set max split size = 256 MB | |
torch.cuda.memory._set_allocator_settings("max_split_size_mb:256") |
This file contains hidden or 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
apt update | |
apt upgrade -y | |
apt install -y apt-transport-https ca-certificates curl gnupg build-essential libjemalloc-dev git zlib1g-dev libssl-dev libreadline-dev libffi-dev locales libsqlite3-dev libyaml-dev libncurses5-dev libgmp-dev libgdbm6 libgdbm-dev tzdata gcc g++ make libpq-dev net-tools ubuntu-dev-tools | |
# jemalloc dependency | |
echo "deb http://security.ubuntu.com/ubuntu impish-security main" | sudo tee /etc/apt/sources.list.d/impish-security.list | |
apt update | |
apt install libssl1.1 | |
touch /etc/apt/sources.list.d/fullstaq-ruby.list |
This file contains hidden or 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 "onnxruntime" | |
require "mini_magick" | |
img = MiniMagick::Image.open("bears.jpg") | |
pixels = img.get_pixels | |
model = OnnxRuntime::Model.new("model.onnx") | |
result = model.predict({"inputs" => [pixels]}) | |
p result["num_detections"] |
This file contains hidden or 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 'sinatra' | |
get "/" do | |
erb :form | |
end | |
post '/save_image' do | |
@filename = params[:file][:filename] | |
file = params[:file][:tempfile] |
This file contains hidden or 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
// https://stackoverflow.com/questions/14249506/how-can-i-wait-in-node-js-javascript-l-need-to-pause-for-a-period-of-time | |
const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) | |
await delay(1000) /// waiting 1 second. |