
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Tiny class that generates friendly tokens using SecureRandom.
Add this line to your application's Gemfile:
gem 'token_generator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install token_generator
TokenGenerator
acts as a namespace for the token
method (see below about customising the generator).
The token
method takes an integer (default 20
) which is the number of characters.
Its second argument is the group size (default 5
). If you don't want groups, pass 0
.
require 'token_generator'
TokenGenerator.token
# => "PXQE2-ZQWTN-PVFQ9-KYWNC"
TokenGenerator.token(12)
# => "KFAE2-YWJQC-PX"
TokenGenerator.token(12,3)
# => "EYV-XAZ-VFF-47N"
TokenGenerator.token(50,0)
# => "XN76KFH9AC2AA66AXJAPT6RNMVCYJ22E4AD4ZK7E9PNFH6XDGC"
include TokenGenerator
in your own class, and override charset
, length
, group_size
Or, to customise the global TokenGenerator by setting accessors.
class DNAGen
include TokenGenerator
def charset
['C', 'G', 'T', 'A']
end
def group_size
3
end
def length
21
end
end
gen = DNAGen.new
gen.token
# => "TTT-CGT-TTT-AAA-GTG-AGA-TCC"
gen.token(120)
# => "CTC-ACT-TGC-GTG-ATG-AGA-AAA-GCT-AGG-GAC-AAT-CCC-AAC-GTT-AGA-TAA-TCA-TCG-CCT-TCT-ACG-CAT-ATG-AAG-ACA-TGA-CCT-TGC-AAT-TCA-CCA-GGT-CTC-CAG-TAC-GAT-AGT-ATC-TCC-TCC"
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that token_generator 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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.