def createFakePosts(): li = LoremIpsum() # find out how many users there are count = models.User.query.count() iterations = 100 for x in range(iterations): # get a random id within the range of the count user1Id = random.randint(0, count) #create a random string li = LoremIpsum() li.get_sentences(1+ x%2) entry = li.get_sentences(1+ x%2) print(entry) #entry = falseData.randomStringGenerator(x, x) #add it as a post #post_text, creator_id, date newPost = models.Post(entry, user1Id, datetime.datetime.now()) db.session.add(newPost) db.session.commit()
def main(): args = parse_args() r = redis.Redis(**config.REDIS_CREDS) li = LoremIpsum() sentences = [li.get_sentences(10) for i in range(100)] for sentence in sentences: r.set(str(uuid4()), sentence) log.info("Seeded 100 records to redis.")
def main(): args = parse_args() redis_creds = vcap.strip_redis_creds( vcap.creds('hsdp-redis-sentinel', tag=args.redis_tag)) r = redis.Redis(**redis_creds) li = LoremIpsum() sentences = [li.get_sentences(10) for i in xrange(100)] for sentence in sentences: r.set(str(uuid4()), sentence) print("Added 100 records to redis.")
def update_texts(self, data=''): """ - In LoremIpsum mode, generates new texts. - In Server mode, add new texts received from TCP socket Other Ideas: - File Mode, monitor a directory for one or more files with lines of text """ #log.debug("updating texts") if args.lorem: self.texts=[] li = LoremIpsum() for l in li.get_sentences_list(args.lorem): lt = MarqueeText(l,textcolor=self.textcolor) self.add_text(lt) return True if args.server: self.texts=[] st = MarqueeText(data,textcolor=self.textcolor) self.add_text(st) return True # check if count or age is too high. # if so, remove the text from the list log.debug("checking for updates. {} texts in queue".format(self.texts)) newtexts = [] for t in self.texts: if not t: newtexts.append(t) continue if self.maxage > 0: if t.get_age() > self.maxage: log.debug("text expired by age t[{}]: {}".format(t.get_age(),t.get_text())) newtexts.append(None) continue if self.maxcount: if t.get_count() > self.maxcount: log.debug("text expired by count t[{}]: {}".format(t.get_count(),t.get_text())) newtexts.append(None) continue newtexts.append(t) self.texts = newtexts log.debug("update done: {} texts in queue".format(self.texts)) return True
def create_users(): word_url = "http://svnweb.freebsd.org/csrg/share/dict/words?view=co&content-type=text/plain" log.info("Getting words for random names...") words = requests.get(word_url).text.splitlines() upper_words = [word for word in words if word[0].isupper()] name_words = [ word.lower() for word in upper_words if not word.isupper() ] li = LoremIpsum() for name in name_words: u = models.Users(name=name, comments=[li.get_sentences(5) for i in range(10)]) db_session.add(u) db_session.commit() del upper_words del name_words
def generate_random_chats(message_count: int, participants: int = 2, chats_number: int = 1) -> List[Chat]: rn = RandomNicknames() li = LoremIpsum() chats = [] # Weighted sentence length probability table message_length_probability = \ [1] * 25 + \ [2] * 35 + \ [3] * 20 + \ [4] * 10 + \ [5] * 7 + \ [6] * 3 for chat_n in range(chats_number): people = rn.random_nicks(count=participants) dt = datetime.now() messages = [] for i in range(message_count): # Generate random time intervals between 10 seconds and 24 hours secs = randint(10, 60 * 60 * 24) dt = dt + timedelta(seconds=secs) # chooses a random sender sender = random.choice(people) # generate random message: sentences_number = random.choice(message_length_probability) text = li.get_sentences(sentences_number) messages.append(Message(sender, dt, text)) chats.append(Chat(f"RandomChat_{chat_n}", people, messages)) return chats
def get_random_sentence(number=10): li = LoremIpsum() return li.get_sentences(number)
class Command(BaseCommand): for tag in tags: # creating independent tags t = Tag(name=tag) t.save() tag_ids.append(t.pk) for i in range(40): # creating users u = User(username=RandomWords().random_word() + str(random.randint(0, 99999)), first_name=RandomNicknames().random_nick(gender='m'), last_name=RandomNicknames().random_nick(gender='m'), email=RandomEmails().randomMail(), date_joined=random_date(d1, d2), password=RandomWords().random_word()) u.save() user_ids.append(u.pk) for i in range(500): # create questions q = Question( head=LoremIpsum().get_sentence(), content=LoremIpsum().get_sentences(5), author_id=random.choice(user_ids), date=random_date(d1, d2), up_votes=random.randint(0, 50), down_votes=random.randint(0, 50), ) q.save() question_ids.append(q.pk) tags = random.sample(tag_ids, 4) for tag in tags: q.tags.add(tag) for i in range(1800): # creating answers a = Answer( content=LoremIpsum().get_sentences(3), question_id=random.choice(question_ids), author_id=random.choice(user_ids), date=random_date(d1, d2), validity=random.choice([-1, 1]), votes=random.randint(-50, 50), ) a.save() for i in range(3000): # views faker q = QuestionView( session=str(random.randint(1, 255)) + '.' + str(random.randint(1, 255)) + '.' + str(random.randint(1, 255)) + '.' + str(random.randint(1, 255)), ip=str(random.randint(1, 255)) + '.' + str(random.randint(1, 255)) + '.' + str(random.randint(1, 255)) + '.' + str(random.randint(1, 255)), question=Question.objects.get(id=random.choice(question_ids)), created=random_date(d1, d2)) q.save() for i in range(120): b = Bookmark( question=Question.objects.get(id=random.choice(question_ids)), user=User.objects.get(id=random.choice(user_ids)), ) b.save()
for c in range(ord('a'), ord('z') + 1): characters.append(chr(c)) for c in range(ord('A'), ord('Z') + 1): characters.append(chr(c)) characters.append(' ') characters.append(' ') characters.append(' ') characters.append(' ') characters.append(' ') characters.append(' ') characters.append(' ') li = LoremIpsum() REPLACEMENT_CHARACTER = u'\uFFFD' NEWLINE_REPLACEMENT_STRING = ' ' + REPLACEMENT_CHARACTER + ' ' # text = """ # Neil Gaiman's family is of Polish-Jewish and other Eastern European-Jewish origins; his great-grandfather emigrated from Antwerp, Belgium, to the UK before and his grandfather eventually settled in the south of England in the Hampshire city of Portsmouth and established a chain of grocery stores. His father, David Bernard Gaiman, worked in the same chain of stores; his mother, Sheila Gaiman (née Goldman), was a pharmacist. He has two younger sisters, Claire and Lizzy. After living for a period in the nearby town of Portchester, Hampshire, where Neil was born in, the Gaimans moved in to the West Sussex town of East Grinstead where his parents studied Dianetics at the Scientology centre in the town; one of Gaiman's sisters works for the Church of Scientology in Los Angeles. His other sister, Lizzy Calcioli, has said, "Most of our social activities were involved with Scientology or our Jewish family. It would get very confusing when people would ask my religion as a kid. I’d say, 'I’m a Jewish Scientologist.'" Gaiman says that he is not a Scientologist, and that like Judaism, Scientology is his family's religion. About his personal views, Gaiman has stated, "I think we can say that God exists in the DC Universe. I would not stand up and beat the drum for the existence of God in this universe. I don't know, I think there's probably a chance. It doesn't really matter to me." # """ def generate_img(font, path, ext="ttf"): text = li.get_sentences(10) text_size = random.choice([25, 30, 35]) font_path = os.path.join("fonts", "{}.{}".format(font, ext))
def setup_class(cls): cls.li = LoremIpsum()
def __init__(self): super(Command, self).__init__() self.rw = RandomWords() self.li = LoremIpsum() self.array_size = 2