-
-
Save moonglum/3479d0fecf19929a0644 to your computer and use it in GitHub Desktop.
Generating Fake Payload data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
## Generate fake vertices | |
# | |
# Generates fake vertices with id, name, age and bio | |
# Uses the faker gem to generate the data | |
# | |
# * The id will be from 0 to n | |
# * The names will contain at least one John Doe | |
# * The age will be between 0 and 100 | |
# * The description will be a Lorem Ipsum text | |
require 'faker' | |
vertices = ARGV[0].to_i | |
paragraphs = ARGV[1].to_i | |
if ARGV.length < 1 or vertices < 1 or paragraphs < 1 | |
puts "Generate with two arguments - both numbers:" | |
puts "* number of vertices" | |
puts "* number of paragraphs per bio" | |
else | |
puts "id,name,age,bio" | |
vertices.times do |id| | |
name = id == vertices/2 ? "John Doe" : Faker::Name.name | |
age = rand 100 | |
bio = Faker::Lorem.paragraphs(paragraphs.to_i).join | |
puts "#{id},\"#{name}\",#{age},\"#{bio}\"" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment