Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Generate decks ready to be imported into Anki! The anki gem will take an array of hashes and convert them into a string which can then be saved to a file that is ready to be imported into your Anki decks.
Add this line to your application's Gemfile:
gem 'anki'
And then execute:
$ bundle
Or install it yourself as:
$ gem install anki
After requiring the anki gem, create a new instance of Anki::Deck
, pass in the headers (as an array of strings) and the card data (as an array of hashes), and generate the deck by using the Anki::Deck#generate_deck
method. The generated deck is a string in the Anki separator format ready to be saved into a file for importing into Anki.
The Anki::Deck can be created either by including the card_headers
and card_data
option when creating the Anki::Deck
object, or by using the Anki::Deck#card_heaers
and Anki::Deck#card_data
methods.
The card data can contain any keys and values. When the Anki::Deck is generated only the keys that match the card headers will be used as output, this may result in a completely empty card so make sure you check your headers and card data appropriately.
require 'anki'
headers = [ "front", "back" ]
cards = [
{ "front" => "Front of the card", "back" => "Back of the card" },
{ "front" => "Another card", "back" => "Another answer", "unused header" => "This will be ignored and not be in the deck" }
]
deck = Anki::Deck.new(card_headers: headers, card_data: cards)
# Alternatively, you can pass in the array of hashes for card data
# after initializing the object:
deck.card_headers = headers
deck.card_data = cards
deck.generate_deck
# => "#front;back\nFront of the card;Back of the card\nAnother card;Another answer"
Alternatively, you can pass an optional file
option when generating the deck to save the string into a file directly.
# If you want to save it into a file directly, you can pass an optional `file` option
# with the path where you want to save the file:
deck.generate_deck(file: "/tmp/anki_deck.txt")
Tags are nothing special. Any field can be used as the Tag. When you are importing to Anki set the Field mapping to "Map to Tags" by clicking on the Change button for the field that contains your tags.
require 'anki'
headers = [ "front", "back", "Tags" ]
cards = [
{ "front" => "Front of the card", "back" => "Back of the card", "Tags" => "one_tag" },
{ "front" => "Another card", "back" => "Another answer", "Tags" => "multiple tags are separated by spaces" }
]
deck = Anki::Deck.new(card_headers: headers, card_data: cards)
deck.generate_deck
# => "#front;back;Tags\nFront of the card;Back of the card;one_tag\nAnother card;Another answer;multiple tags are separated by spaces"
By default, fields are separated by semicolons when generating a deck. If you want to use a custom field separator, you can add an optional field_separator
option when generating the deck.
require 'anki'
headers = [ "front", "back", "Tags" ]
cards = [
{ "front" => "Front of the card", "back" => "Back of the card", "Tags" => "one_tag" },
{ "front" => "Another card", "back" => "Another answer", "Tags" => "multiple tags are separated by spaces" }
]
deck = Anki::Deck.new(card_headers: headers, card_data: cards, field_separator: "|")
deck.generate_deck
# => "#front|back|Tags\nFront of the card|Back of the card|one_tag\nAnother card|Another answer|multiple tags are separated by spaces"
git checkout -b my-new-feature
)git commit -am 'Add some feature'
) and make sure your write tests for your new feature!git push origin my-new-feature
)FAQs
Unknown package
We found that anki 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.