
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
usda-nutrient-database
Advanced tools
The USDA nutrition database is a great source of nutrition information. However, the data formatting options (plain text ASCII files or MS-Access) leave a little to be desired.
This is a simple gem to import the database into your ruby application.
Even after importing this data, keeping it up to date and adding/maintaining additional logic such as full text search, weight conversion, etc is a pain. As an alternative I have put together a small RESTful web service to do this for you. You can find the docs at http://docs.usdanutrientservice.apiary.io/
Add this line to your application's Gemfile:
gem 'usda-nutrient-database'
And then execute:
$ bundle
Or install it yourself as:
$ gem install usda-nutrient-database
If you're using rails then copy the migrations across:
rake usda_nutrient_database_engine:install:migrations
UsdaNutrientDatabase.configure do |config|
config.batch_size = 20000 # import batch size, if using activerecord-import
config.perform_logging = true # default false
config.logger = Rails.logger # default Logger.new(STDOUT)
config.usda_version = 'sr25' # default sr28
end
If you are running MySQL => 5.6 or PostgreSQL => 9.5 then you're in luck, you can use UPSERT (insert or update) to speed up imports x30. To do this you're going to need to install activerecord-import
require 'activerecord-import/base'
ActiveRecord::Import.require_adapter('postgresql')
# You may want to disable logging during this process to avoid dumping huge SQL
# strings in to your logs
ActiveRecord::Base.logger = Logger.new('/dev/null')
Now run the rake task which will import everything in around 2 minutes.
rake usda:import
Import the latest data with the import task:
rake usda:import
This is going to take a while. 60+ minutes on my 2.66 GHz i7 macbook pro. You ca also import individual tables using the other import tasks. To see the available tasks:
rake -T usda
Use the models to query and profit:
UsdaNutrientDatabase::FoodGroup
UsdaNutrientDatabase::Food
UsdaNutrientDatabase::Nutrient
UsdaNutrientDatabase::FoodsNutrient
UsdaNutrientDatabase::Weight
UsdaNutrientDatabase::SourceCode
If you find a bug then add it to the issues here on github. Ideally with a pull request to fix it, or at least with a failing test. When you report a bug, number 1 rule is: don't be a dick.
Any feature requests/ideas can also go in the issues list.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Many thanks to the following contributers:
This gem follows Semantic Versioning
FAQs
Unknown package
We found that usda-nutrient-database demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.