secret_santa.py

This year the family is doing a secret santa, instead of the regular gifts-for-everyone approach. I think it's a good idea as I only have to think up one amazing present instead of seven.

There was talk about who would do the randomizing of names, which ruined the surprise for that one person. I suggested that the internet could probably provide that service, but then hesitated at the thought of putting all our email addresses into a random website.

I decided to write my own secret santa service instead. At first I wrote it in PHP - like this website is - and spent a good hour trying to remember basic PHP concepts like "do lines have to end with semi-colons?" and "how do you print to standard out?". I used to PHP errday, so this made me feel bad. I reasoned that I forgot all my PHP from 2010 because I moved to python after that. I figured I would write secret santa in Python.

Then I spent another few hours trying to remember basic python syntax, and debugging issues. It took me about the same amount of time to remember how to print formatted strings as it did to finalise the script.

But, I ran it, and it worked, so I figured I would share it on my journal as evidence that I still do some scripting occasionally. I even formatted it with CSS to be easier to read... This also took at least an hour to do...

##########################
###    SECRET SANTA    ###
###  Bradism.com 2016  ###
##########################
# Set Values Below:
SMTP_DETAILS = {  # Available from your Webhost or ISP
   'SMTPserver': 'your.smtp.com',
   'sender': 'YOUR_EMAIL_ADDRESS',
   'username': 'SMTP_USER_NAME',
   'password': 'YOUR_SMTP_PASSWORD'
}

# Create a dictionary of participants, adding their name, email address and a description of what they might want/not want.
# The "gift" field will be included as HTML, so all HTML tags are valid and make sure to escape double-quotes
giftees = {}
giftees['Brad'] = {'email': 'brad@example.com', 'gift': "Yogurt, Cereal, Fruit.<br />No cats!"}
giftees['Dwight'] = {'email': 'dwight@atlanta.com', 'gift': "I'd like to shoot more threes and have someone yell \"Dwight for THREEEE\" even if it looks like missing."}
giftees['Rajon'] = {'email': 'big_game_rondo@gmail.com', 'gift': "<ol><li>Connect 4 Opponents</li><li>A call from Paul Pierce</li></ol>"}
giftees['Gortat'] = {'email': 'marcin@hotmail.com.com', 'gift': "I miss Stan Van Gundy. Also, shaving products."}

>>> See the Full Article

Leave Comment

The Horrible Truth Uncovered

I was returning to bed from the toilet sometime this morning, when it was too dark to consider checking the time. I found my side of the bed blanketless, which was how I'd left it. But it was cooler now.

Luckily my eyes were adjusted to the dark, and I could make out two distinct blankets wrapped around my wife. My fingers were nimble enough to pry them apart, and my shoulders had the strength and leverage to pull a blanket over my legs while lying down, conquering the resistance of Vanessa's death grip on the material.

So smooth was this operation that it barely registered in my brain and I was immediately falling asleep again. Until I realised how many generations of natural selection and frozen, dead men there must have been over the millennia for me to have evolved with the physical traits needed for blanket rescue.

Leave Comment

31 Seconds of Brain Activity

What's happening in Aleppo and Syria is horrible. I wish there was something I could do to help those people. I'm afraid the worst is already done. It was done decades ago and there's nothing that anyone can do to stop what's been started. Especially me, a dude on the other side of the world. I think I'll just be the absolute best human that I can be to every person I meet, and hope that others do the same and that it will all work out in the end. I also think I'll switch to roll on deodorant permanently. I seem to sweat less than with spray-on deodorant. First I'll have to clip my armpit hair. That kind of excites me. I'll have an excuse to groom myself. I know it's 2016, I don't need an excuse. But it's nice to have one in case someone thinks I'm vain for trimming my pits. It will also be more convenient when I travel as I won't need to pay for checked baggage just to transport an aerosol can of deodorant. My only concern is that roll-on deodorant might cause cancer. If the pores are too blocked up and sweat can't come out of them then maybe cancerous sweat cells will be trapped in my body and mutate and spread to my lymph-nodes. What an odd way to die. I assume no one has died like this already, otherwise I'd have heard about it. And they would have stopped selling roll-on deodorant. It could potentially become my legacy. They'd name the pathology results after me. It'd be my legacy for years, maybe decades or centuries assuming humanity survives that long and survives that long without curing cancer. I bet they won't survive that long. The whole human race nothing but a second-long flutter of a single hair on the back of this great, eternal beast known as the universe, which seems to exist only because if nothing existed it would be a mind-fucking conundrum and physics probably dictates that something has to exist just to prevent existential implosions of the metaverse. Fuck me. Life is so pointless. Ah, the cricket is back on.

Leave Comment

Glass Half Empty

I haven't touched any alcohol for almost a week now. I didn't plan that. I thought the end of work-Christmas-summer period would see me with a beer almost daily. Especially with 40 degree days, long sunsets and family gatherings. The week before holidays I even stocked up on booze thanks to an amazing Specials + AMEX Cashbacks + Flybuys Rewards + reusing online voucher for multiple purposes + Reduced to Clear stickers to pick up a case of half-litre Weihenstephan Hefe (cheaper than a flight to Munich) plus a carton of Squires Hop Thief, a Knappstein IPA four pack, a new variety of Fat Yak six pack and fresh bottles of Bacardi, Vodka and Gin. Add that to my existing random beer collection, the last few Hoegaardens from my 32nd, the (two kinds of) spiced rums I've got in the pantry, the Hennessy from my 31st, the single Sly Fox I've been saving for the start of Summer since April, the diet ginger ale that I bought (the best way to drink 12 year old whiskey) plus the Champagne, Aperol, Kahlua from 2013's Duty Free shopping... This is beginning to sound like a thrown away draft for a cheesy EDM rap verse.

Every day from lunchtime onward I think I should have or make a drink. Something always stops me. Maybe it's too hot, or I'm full of food, or I still need to go to the gym. The day moves on without me and then it's too late to have a drink and then I wake up and the cycle repeats.

It got to Boxing Day and I thought, maybe, I've reached this subconscious contentedness that belies the feelings of thirst and relaxation. Maybe I'm mentally unclenched, ascended, and found a new level of human existence where I'm buzzed on life itself.

Then I realised, when having yet another internal debate about opening a beer or making a gin and tonic, what was keeping me away from the liquor was not any state of higher feelings, but the exact same thing which fucks me whenever I run out of bulk lunch meals on work days and I have to pick a restaurant/food court/food truck from the thousands in the city. The days that I end up eating Weet Bix at my desk for lunch. Analysis Paralysis. I've accumulated so much booze that I am now unable to pick which one to drink first. It's the INTJ 1 Step Program.

Leave Comment

Priorities

These two pots of Calla Lilies are bringing the lesson of 2016. A month ago these pots contained nothing but dirt and the dormant bulbs from last summer. By the end of spring both had green shoots emerging from the dirt. The pot on the right started with many shoots, the left pot had only a couple. A few weeks later the left pot had sprouted two proud, vibrant flowers while the pot on the right has nothing to show for itself but leaves on leaves.


The obvious moral is that if you diversify your attention and resources to too many things you're going to end up with a bunch of leaves and no flowers. By focusing on only a couple of candidates you're better placed to bring them to fruition.

Leave Comment

Cameraphone Photos of the Year

To celebrate the end of 2016 I created a new phocumentary.

It's all on one page, because it's 2017 tomorrow. And we're all on the NBN, right? (Or browsing on the phone using work's fibre backed wifi while on the toilet).

Leave Comment

Previous Section Next Section