defaults write com.apple.screencapture type jpg; killall SystemUIServer
# Your options are JPG, TIFF, GIF, PDF and PNG.
Security Update Rails (CVE-2022-32224)
Updating rails with the secrurity update CVE-2022-32224, "Possible RCE escalation bug with Serialized Columns in Active Record".
can cause troubles in rails projects. (I had several project that has issues with this fix).
https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017
The main change is that the YAML loader is using safe_load
to parse the string. Most classes aren't supported anymore.
Several essential classes have been removed.
To support my Spree Commerce rails projects, I've had to add the following initializer.
ActiveRecord::Base.yaml_column_permitted_classes += [BigDecimal, Symbol]
Other projects requried the HasWithIndifferentAccess
ActiveRecord::Base.yaml_column_permitted_classes += [ ActiveSupport::HashWithIndifferentAccess]
Please try to keep the number of supported classes.
I personally prefer to use JSON for new projects. Because it's simple and clean.
Directly send an e-mail in rails without template
Snippet to directly send an e-mail in Rails, without templates
ActionMailer::Base.mail(
from: "gamecreatre@example.com",
to: "receiver@example.com",
subject: "Sample Subject",
body: "Message Body"
).deliver
Snippet to find string files of a given filename
find . -name config.rb -print0 | xargs -0 grep 'search-thing'
Extract single table from a MySQL dump
sed -n -e '/DROP TABLE.*`table_name`/,/UNLOCK TABLES/p' dump.sql > table_name.sql
Source: https://ruleoftech.com/2019/restore-single-table-from-full-mysql-database-dump