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.
Somehow I’ve been working with python for 2 years now and never knew this was a thing. Wow.
Here’s a neat little trick/hack I learned today for being able to quickly control crontab jobs from routes in your node application.
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.
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.
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
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.
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.
After much frustration, I finally found the tutorial that I needed to help me get my head wrapped around sessions: medium post
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.