Ordinary Data Structures: Python3’s deque to Store Recent Emojis

Recent Emojis

if the implementation is simply the most recently used 30 emojis, then some sort of ordered iterable array-like structure would be best suited to the problem. Since 0 index insertions are an important requirement, Python’s built in deque data structure would be a good candidate to use here.

deque is found in the collections library and accepts an array-like input of values along with an optional keyword argument named maxlen which specifies the maximum length of the data structure. This last part is ideal for this application, as Apple’s implementation limits the recently used emojis to 30.

from collections import deque

recent_emojis = deque([], maxlen=30)

def update_recent_emojis(emoji_used, recent_emojis : deque):
    if emoji_used in recent_emojis:
        recent_emojis.remove(emoji_used)

    recent_emojis.appendleft(emoji_used)
    return recent_emojis


About Time — I find my favorite movie

I’ve recently rewatched the film “About Time” and am now comfortable declaring it as my favorite film. Besides the high degree of relatability I have with the plot, being a somewhat awkward and goofy young professional who somehow stumbled into an instant love with an incredibly sweet girl, I enjoyed the humorous juxtaposition of the mundane alongside the incredulous and supernatural.

The film is a sweet story not so much about time travel as it is one about coming to terms with your individualism, however undervalued those quantities might have been in your youth.

I thought it was substantial that the father not reveal the family secret to Tim until he was twenty one years old. Thematically, I think this decision enabled the film to convey valuable life lessons to an older audience than most films. The familiar setting of the film, particularly as it relates to my life (especially where I am in life currently), enabled me to become significantly attached to the characters off the bat, especially Tim.

As the plot rolls forward following Tim’s path through time forwards and back, his humble journey elicited a range of joy, despair, glee and remorse as he wielded his incredible gift against the familiar trials of life, with mixed results. I grew increasingly empathetic of Tim and his mostly noble choices, impressed by his attempt to always make those around him happy and fulfilled.

Tim triumphs over what he had initially declared to be the purpose he would pursue with his powers, as he settles into love and then family with Mary. Meanwhile, his father, who energizes the plot with the revelation of time travel, is revealed to be dying and his condition worsens rapidly thereafter. In this swift course of dopamine reversal, the film forced the focus away from Tim and instead towards introspection.

The scene that really gets me is the last one with Tim and his father. His father, James laments that his cancer is unavoidable even with their endowed power. Before he dies, he shares with Tim his “secret formula” for happiness including a recipe for using the gift:

And so he told me his secret formula for happiness. Part one of the two part plan was that I should just get on with ordinary life, living it day by day like anyone else. But then came part two of dad’s plan, he told me to live every day again almost exactly the same. The first time with all the tensions and worries that stop us noticing how sweet the world can be. But the second time noticing.

Finally, Tim comes to embrace normality in its entirety. As the film exhausts its last bit of kinetic energy, Tim shares one last nugget of insight

In the end, I think I’ve finally learned the final lesson from my travels in time. And I’ve even gone one step further than my father did. The truth is, I now don’t travel back at all – not even for the day. I just try to live every day as if I’ve deliberately come back to this one day to enjoy it. As if it was the full final day of my extraordinary ordinary life.

With this, the credits begin to roll following a stream of tears. This movie always leaves me touched, inspired, happy and looking forward to my life ahead. Lastly, I can’t help but wonder if Tim will choose to share the family secret with his son, Jeff — only time will tell.

Summarize Text Feature High Sierra OSX

Usually I disdain doing the Software Updates on my Mac / iPhone (although, the experience is far better than the process on Windows), but after updating to High Sierra 10.13.4, I was really impressed with a niche new feature: text selection summary.

Here’s a quick walkthrough of where to find it and how to use it:

  1. Select multiple sentences / paragraphs of text (from a website, a document, email, etc). Then right click and enter the submenu for “Services” at the bottom.

Screen Shot 2018-05-24 at 10.16.36 AM.png

2. After selecting “Summarize”, a program called “Summary Service” will pop up in a new window. When it first pops up, it will show the entire selection, but you can toggle the controls below.

Screen Shot 2018-05-24 at 10.29.09 AM.png

3. Summary Size slider

 

Screen Shot 2018-05-24 at 10.51.25 AM.png

Now if only Apple would release a text expand slider so that students can make it to the word count on their essays.

Falcon Heavy Launch

Last week I went to the Falcon Heavy Demo Flight at the Kennedy Space Center in Cape Canaveral, Florida, (USA Earth for future / Mars settled readers). Elon Musk launched his cherry red Tesla Roadster to Mars orbit. It was the most inspirational and incredible thing that I’ve ever witnessed.

I made a conscious decision to be “in the moment” (as prescribed to the crowd by the ever-wise, Bill Nye The Science Guy), so as an unfortunate side effect I do not have very many original photos of the experience. In fact, here is one of the only relevant photos that I have which was taken after most of the significant events had occurred. My heart was racing and nothing could eclipse the triumph felt by me and everyone else in attendance. IMG_9689.jpg

 

Below are some impressive photos (all sourced from SpaceX’s flicker account).

Here is a really cool animation of the demo flight.

Here is another really cool video taken of the boosters landing:

First Post

This is the first blog post I have written. I plan to document some of the new languages / frameworks / methodologies that I learn through work and elsewhere. Currently, I am a software developer at Huguenot Fuels where I work primarily in Python / Django. My role also involves designing, configuring, deploying and maintaining resources on AWS as well as Heroku. I do a lot of ETL workloads along with data analysis / reporting via pandas / numpy / bokeh. I’m working to learn more Javascript, particularly AngularJS (to consume and build upon the Django REST API I’ve built. I also have general interests in automation, space exploration, arbitrage and natural language processing. Checkout my Github or follow me on Twitter to learn more!

 

–  Graham

2018-01-26