TIL: Randomizing with %

So I’ve been working on a traffic simulator project at work, and one of the things that I try to do is generate unique, sensible data for each of the posts that I send. Try to, you know, actually simulate what’s going to be going through the system. In the past I’d often relied on just using the random.random() function to generate a base number, then multiply it by the max value I’d want, then finally round it up to where I’d want it to be. But that’s a lot of overhead if I just want to, say, randomize the selection of an item from an array.

1 min read

TIL: Printing to same line in console with Node

Tonight I learned a trick for doing something that I’ve wanted to know how to do for a while now: updating the same line on the console/stdout when printing data. You know, kinda like you see when you’re installing packages and such.

~1 min read

TIL: Setting MongoDB to Automatically Delete Records

As part of the next project I need to complete at work (actually should have completed this weekend, oops), I’m going to need to be purging data from a MongoDB pretty regularly (thinking every week or so) in order to keep the db from getting to large. The application in question is just used for test and holding test data so, I don’t need any crazy data retention in it. And it will be storing upwards of 14mil new pieces of data a day so… it needs to be cleaned out.

1 min read

TIL: Automating AWS with Python and Boto, pt1

I’ve been curious as to whether there was a way to automate the deployment/management of EC2 instances for a while now but only finally just got around to it today. Turns out there’s a pretty nice package for Python that will handle a lot of it for you, called boto.

~1 min read

TIL: Session Weren’t That Hard

The first iteration of my side project at work is finally finished. I was able to get sessions working just as I had always imagined them working, and it’s such a beautiful thing. Oh, and I was making them way harder than they needed to be.

1 min read

TIL: Global Variables

Still working though sessions. The tutorial didn’t turn out to be everything that I wanted it to be, but I think I may have found a way around it. Just haven’t had time to explore enough to have my answer on whether or not it’s going to work. In the mean time I learned how to set a global variable today, despite the internet yelling at me not to.

~1 min read

TIL: Sessions: I Don’t Know What I’m Doing

I spent a good chunk of time today playing with and reading documentation for sessions. Just when I thought I was starting to get a grasp on what I’d need to do to handle my scenarios, I’d come across something that would completely contradict what I’d been reading. That’s starting to wear on me a little bit.

1 min read