- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- They are the people who get things done. Effective Engineers produce results.
| require "bundler/inline" | |
| gemfile do | |
| source "https://rubygems.org" | |
| gem "activerecord", require: "active_record" | |
| gem "activejob", require: "active_job" | |
| gem "sqlite3" | |
| gem "searchkick", git: "https://github.com/ankane/searchkick.git" | |
| end |
| #include <stdio.h> | |
| #include <inttypes.h> | |
| #include <math.h> | |
| // Function, which calculates N, p and r from opslimit and memslimit copied from | |
| // libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c | |
| int pickparams(unsigned long long opslimit, const size_t memlimit, | |
| uint32_t *const N_log2, uint32_t *const p, uint32_t *const r) { | |
| unsigned long long maxN; | |
| unsigned long long maxrp; |
Add to the Devise initializer:
config.send_email_changed_notification = trueUse this PR for attr_encrypted
| 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"] |
| require "onnxruntime" | |
| require "mini_magick" | |
| require "numo/narray" | |
| img = MiniMagick::Image.open("images/32576677167_a066c5a7aa_z.jpg") | |
| img.resize "448x448^", "-gravity", "center", "-extent", "448x448" | |
| pixels = Numo::NArray[*img.get_pixels] | |
| pixels = pixels.transpose(2, 0, 1) | |
| pixels = pixels.expand_dims(0) |
| # https://github.com/onnx/models/tree/master/vision/body_analysis/emotion_ferplus | |
| require "onnxruntime" | |
| require "mini_magick" | |
| img = MiniMagick::Image.open("ranger.jpg") | |
| img.crop "100x100+60+20", "-gravity", "center" | |
| img.resize "64x64^", "-gravity", "center", "-extent", "64x64" | |
| img.colorspace "Gray" | |
| img.write("resized.jpg") |
| # Bootstrap AWS Deep Learning Base AMI (Ubuntu 18.04) | |
| # install Ruby | |
| sudo snap install ruby --classic | |
| # install LibTorch | |
| wget -O libtorch.zip https://download.pytorch.org/libtorch/cu102/libtorch-cxx11-abi-shared-with-deps-1.7.0.zip | |
| unzip libtorch.zip | |
| # download |
| 1 | 3.7 | 1.2 | 7.2 | 9 | |
|---|---|---|---|---|---|
| 1 | 7.5 | 0.5 | 7.9 | 0 | |
| 1 | 1.6 | 0.1 | 7.6 | 7 | |
| 0 | 0.6 | 2.5 | 5.0 | 4 | |
| 1 | 1.8 | 8.4 | 1.1 | 2 | |
| 2 | 6.8 | 8.7 | 8.7 | 9 | |
| 2 | 9.4 | 9.6 | 8.6 | 9 | |
| 1 | 0.9 | 0.7 | 6.3 | 6 | |
| 0 | 5.7 | 0.1 | 0.0 | 1 | |
| 1 | 0.8 | 8.8 | 1.3 | 3 |
| require "bundler/inline" | |
| gemfile do | |
| source "https://rubygems.org" | |
| gem "activerecord", require: "active_record" | |
| gem "sqlite3" | |
| gem "lockbox", git: "https://github.com/ankane/lockbox.git" | |
| end |