Hockey Twitter Bot – Open Sourced

Posted on

Today, I finally uploaded the code that runs @NJDevilsGameBot to my Github account.

A few years back, when I got my first Raspberry Pi and learned that the NHL had an API (although no official documentation exists, the current community driven documentation can be found here), I decided to pick up the basics of Python and build something. I ended up putting together a python script that would use the NHL API schedule endpoint to watch for changes in score of New Jersey Devils games and then trigger red beacon lights and the goal song through my receiver. The code was messy and the setup was too unique so I never published it anywhere.

A few weeks ago I decided I want to take some of the foundations built in the aforementioned code, advance my Python skills a bit and Hockey Twitter Bot was born. At its core, the bot is a python script that parses the NHL Schedule & Live Feed API endpoints to gather relevant game events and tweet them to the game bot Twitter account. Some more information (such as events that are parsed and tweeted) and other technical details can be found in the README of the Github repository.

The code is very much a work in progress and considering my Python skills are far mediocre at best, the code will always be. To be honest, the only reason I put the code onto Github is because I am hoping that people that are more proficient in Python than me find it and send me pull requests to fix bugs, remove redundant code or just tell me what I am doing wrong and how it can be better.

I have embedded some sample tweets at the bottom of the post as well just to showcase some sample functionality.

PS – if you are a Devils fan & are not following @NJDevilsGameBot – why not?

Pre-game tweet sent out one game days

Final score & boxscore stats image

3-Stars of the Game

A goal scored with assists added via quote tweet
Scoring changes are done the same way

End of period (showing shot totals)

Starting Lineups (as accurate as possible)

Hockey Twitter is 🔥🔥

Posted on

I am a big hockey fan (it is probably my favorite sport) and my team of choice is the New Jersey Devils. In my opinion, the NHL has one of the best social media presences of all the major sport leagues – both the teams and the fans. Not only are the team’s official accounts very engaged with their fans on the social media platform but you’ll often find teams tweeting at other teams on game night, thanking them for trades or even having their mascots go at it on their official Twitter accounts. It is quite entertaining to watch.

For those that don’t know, Lou Lamoriello – the former Devils General Manager – was a very old school GM and had strict rules against facial hair and social media; both the players being active as well as the official team account. Ever since Lou left the organization facial hair is on the rise, but more importantly the social media team has been outstanding. They are big users of GIFs (with a hard G) and love to troll other teams, fans and beat writers.

The other night, a fan of the Buffalo Sabres decided to revisit the old joke of the Devils being a boring hockey team (har har) and the Devils official Twitter Account had some thoughts about that.
 

Here are some other fun examples of the Devils Twitter account & hockey Twitter in general being awesome. If you think these tweets are funny, but don’t want to follow the official accounts for all 31 NHL Teams, I made a Twitter list just for that.

Roberto Luongo on the Super Bowl

Phil Kessel on being snubbed for Team USA

The Washington Capitals on NOT being Pittsburgh

Kevin Spacey on Kevin Spacey in Space Night!

Detroit Red Wings Penalty Box Photo Bomb

P.K. Subban HAD the Best Hair!

Obviously these tweets are all in good fun, but it’s nice to see the Devils have an active and engaged social media presence for a team that was locked down for so long especially considering how active the rest of the league is on the platform.

Update – February 9, 2017 @ 10AM: Scrolling through Twitter and what do I see this morning, but an amazing exchange between the Devils & Pete Blackburn, a writer for FOX Sports.

Twitter – An Update on Safety » 

Posted on

I joined Twitter in April of 2008. Back then it was a place to literally tell the world what you were up to at that specific moment in time. It’s kind of funny to look back at my old tweets and see the difference in the social network from then to today.

My first tweet is actually pretty embarrassing, but here it is anyway.

Over time Twitter has become a place to share news opinions & media in real-time, as well as share your daily musings. I remember distinctly one of the first pictures of Flight 1549 – the US Airways Flight that landed in the Hudson River – was someone on a NY Waterway Boat tweeting a picture of the plane as their boat was sent to rescue passengers.

The recent United States Presidential Election has brought to Twitter more arguments and harassment than ever before. There are countless Twitter Eggs that you’ll come across in the replies of politicians and news organizations. Due to this, Twitter seems to have made a commitment in 2017 to create a safer environment for all users on its platform.

Today, Twitter has introduced three changes to make the platform a safer place for daily use & engagement –

Stopping the creation of new abusive accounts:
We’re taking steps to identify people who have been permanently suspended and stop them from creating new accounts. This focuses more effectively on some of the most prevalent and damaging forms of behavior, particularly accounts that are created only to abuse and harass others.

Introducing safer search results
We’re also working on ‘safe search’ which removes Tweets that contain potentially sensitive content and Tweets from blocked and muted accounts from search results. While this type of content will be discoverable if you want to find it, it won’t clutter search results any longer. Learn more in our help center.

Collapsing potentially abusive or low-quality Tweets:
Our team has also been working on identifying and collapsing potentially abusive and low-quality replies so the most relevant conversations are brought forward. These Tweet replies will still be accessible to those who seek them out. You can expect to see this change rolling out in the coming weeks.

These changes are a welcome addition to the platform and I hope to see Twitter do more to address issues of harassment and abuse on their social network. 2017 seems to be the year of change and improvement for Twitter and so far I give them two thumbs up.

👍👍

Automatic Weekly Recaps with Workflow on iOS

Posted on

I posted my first Weekly Links Recap a few days ago as a way to share some interesting articles I’ve come across during the week that I may not have had time or enough opinion on to give their own blog post. When I first had this idea it seemed like a lot of work to find the link, grab the excerpt (or provide my own blurb), put it into a draft post in my blog and remember to always post on Fridays – I figured that sooner or later I might find the effort not worth the reward. 

As a nerd, programmer and loyal iOS Workflow user I knew there had to be a better way to accomplish this & I was right! To give a bit of background, before I owned an iPhone, I was a loyal Android of almost 7 years and I had automated a lot of daily activities using Tasker, a phenomenal app that let you perform a set of tasks based on triggers or contexts. When I found out about Workflow on iOS, it was an instant purchase and it definitely has more than $4.99 worth of functionality. Due to the nature of iOS it is not as powerful as Tasker, but what it is able to do still boggles the mind.

A sample screenshot of my “Share Links to Dropbox” Workflow.

Share Links to Dropbox Screenshot

In order to accomplish this automation I built two separate workflows. The first one (and the more complicated of the two) I call Share Links to Dropbox and it’s steps are as follows –

  1. Store the URL & Text as INPUT
  2. Grab the URL from INPUT
  3. Store it as URLINPUT
  4. Grab the Text from INPUT
  5. Store it as TEXTINPUT
  6. Use the Get Article from Web Page action
  7. Store the article as URLARTICLES
  8. Use the Get Details of Articles > Title action to get the Title of the Article
  9. Store as URLTITLE
  10. Check IF URLTITLE = URLINPUT
    1. If True Choose from Menu (Manually Input Text or Use Article Excerpt)
      • When a workflow accepts both Text & URL, if no text is elected the Get Text from Input also returns the URL. This allows me to enter my own excerpt / blurb.
      • If Manually Enter Excerpt is chosen, Ask for Input and store that in URLEXCERPT
      • If Use Article Excerpt is chosen, use the Get Details of Articles > Excerpt action and store that in URLEXCERPT
    2. If False, store TEXTINPUT into URLEXCERPT
  11. Get the Current Date
  12. Use a custom Date Format of w to get the week number
  13. Store that as WEEKNUMBER
  14. Format all variables into Markdown formatted text for my blog

    * [URLTITLE](URLINPUT)
    > URLEXCERPT

  15. Pass the above Text into the Append to Dropbox File action with the following parameters –
    1. Mode: Append
    2. File Path: Apps/iOSWorkflow/WeeklyLinks_W<WEEKNUMBER>
    3. Make New Line: Yes

That may seem like a lot of steps, but it covers all use cases for sharing. If I want use what Workflow assumes to be the excerpt of the article I can do so, if I want to select another part of the article to be the excerpt I can do that, or if I want to supply my own custom blurb I can do that as well.

While the Share Links to Dropbox workflow is a bit complicated (and contain 34 steps) the workflow that actually creates the post is much simpler at a grand total of 5 steps! That workflow is called Create Weekly Links Blog Post and it’s steps are –

  1. Get the Current Date
  2. Use a custom Date Format of w to get the week number
  3. Store that was WEEKNUMBER
  4. Get the Current Date
  5. Use a Date Format of Long
  6. Store that was POSTDATE
  7. Use the Get Files from Dropbox action with the following parameters (matching the Append to Dropbox File action from the first workflow) –
    1. Show Dropbox Picker: Off
    2. File Path: Apps/iOSWorkflow/WeeklyLinks_W<WEEKNUMBER>
    3. Error If Not Found: Yes
  8. Pass that file into a Post to WordPress Action with the below parameters –
    1. Title: Weekly Links Recap * <POSTDATE>
    2. Type: Post
    3. Format: Standard
    4. Status: Draft

Instead of having to remember to run the Workflow at 7AM on Friday mornings, I setup a Launch Center Pro notification action that allows me to automatically run that workflow from a notification I receive at that time. Once I am fully awake for the day and have some downtime at, I will do a quick proofread of the post and publish it to my blog.

I am sure that my workflows are by no means perfect, but so far they get the job done and probably save me a lot of time and headache. This time savings and versatility will allow me to keep this series of weekly recaps going without any hassle.

Weekly Links Recap – February 10, 2017

Posted on

I spend a lot of time on Twitter and catching up on RSS feeds during the week, reading a ton of insightful and interesting articles. What a good way to ensure that my blog stays active, but to share some the most interesting articles I’ve read during the week. I think it will be also be quite fun to take a look back to see what news was interesting at this time a year from now.

View the rest of the Weekly Links Recaps here!

  • Apple Overtakes Samsung As World’s Top Smartphone Vendor in Q4 2016

    Apple overtook Samsung to became the world’s largest smartphone vendor in the fourth quarter of 2016 as shipments reached 439 million units. According to independent research firm Strategy Analytics, global smartphone shipments grew 3 percent annually to hit a record 1.5 billion units in 2016.

  • Switch Your AirPods Connection Easily with Tooth Fairy

    It’s become no secret that I, along with countless others, am absolutely in love with my AirPods. I’ve only had them for a couple of weeks, but I’ve already built a habit of keeping them in my ears for hours on end, switching between my iPhone and Mac to catch up on podcasts, listen to music, and watch YouTube videos.

  • iPhone 8 concept shows off display covering entire front of iPhone, dynamic Home button, more [Video]

    In a new video released today, ConceptsiPhone shows off some interesting possibilities for Apple’s 10th anniversary iPhone, including a display that covers the entire front of the device. While reports suggest that iPhone 8 will move to an all glass design, the concept dreamed up in iPhone 8 Commercial by Thadeu Brandão shows off a design similar to iPhone 7 Plus with the addition of some other rumored features.

  • Instagram Testing Multi-Photo Albums in Version 10.7.0

    Somewhat hidden inside version 10.7.0, which is trickling out to users on Android, Instagram appears to be testing the ability to showcase multiple photos in a single post. You have probably seen this feature enabled for advertisers on your timeline, but if testing goes well, it seems that normal folk will be able to use it, too.

  • Apple Said to Work on Mac Chip That Would Lessen Intel Role

    No compatible source was found for this media. Why Apple Is Designing Chips for Future Laptops Apple Inc. is designing a new chip for future Mac laptops that would take on more of the functionality currently handled by Intel Corp. processors, according to people familiar with the matter.

  • Fire Emblem Heroes Arrives on the App Store

    Nintendo’s third iOS title, Fire Emblem Heroes, is now available on the App Store. The game, which features characters from throughout the history of the popular Fire Emblem series, is also launching on the Google Play Store today.

  • What gets Googled more?

    A frustratingly addictive game of higher or lower using Google searches. The data is based on global monthly searches in 2016.

  • Snapchat growth slowed significantly after the launch of Instagram Stories

    Snapchat seems to have hit a bit of a wall. In early 2016, Snap was unstoppable. Between the fourth quarter of 2015 and the third quarter of 2016, the service added 46 million average daily active users — pushing its total to 153 million active users per day.

  • Rock Out in a Perfectly Restored Range Rover for Just $170K

    Jaguar Land Rover has a rich heritage of building cool cars, and lately, it’s started up a new tradition of turning that patrimony into patrimoney. Three months after Jaguar relaunched the 1950s-era XKSS, its SUV-slinging sibling has started “Range Rover Reborn,” a program to revamp cars it built in the 1970s for life on today’s roads.

  • Volkswagen agrees to yet another diesel cheating settlement

    Volkswagen has agreed to pay at least $1.2 billion to compensate US owners for lying about emissions on 3.0-liter diesel vehicles. Owners of 20,000 model-year 2009-2012 cars — which can’t be fixed to meet legal standards — will be offered a buyback or trade-in and from $7,755 to $13,880 in compensation, depending on the model.

Use plug-ins in GarageBand to improve podcast sound »

Posted on

I recently started looking around at what I needed to create a podcast. Besides coming up with a good title and concept, I knew that I wanted it to sound half as good as a lot of the podcasts I listen to (see Relay.FM, ATP, etc). Besides getting a decent microphone and understanding the basics of good microphone technique, I knew I needed to understand some of the audio processing steps that took a podcast from good to great. A quick search on Google & by no surprise Jason Snell (of the wonderful Six Colors) has a great post on simple ways to use Garage Band to do just this.

However, GarageBand is perfectly suitable for podcast editing, and don’t let anyone tell you different. Every Mac comes with GarageBand, meaning every Mac user has access to a free multitrack audio editor capable of generating high-quality podcasts. And while it’s true that the latest version of GarageBand (version 10) lacks some of the podcast-specific features of GarageBand 6.0.5 and earlier, it’s not true that you can’t edit a podcast in the current version of GarageBand. You can! (Earlier on Six Colors I wrote about editing podcasts in more depth.)

Jason points out that although a lot of podcast editors may use Logic or expensive Digital Audio Workstations to make their podcasts sound like they were recorded in professional studios, a lot of what is needed to make a podcast sound better than most can be accomplished in GarageBand. I have created the presets discussed in the article and even recording directly into my MacBook Pro’s built-in microphone I notice a significant difference in sound quality.

With all that said I will be starting my own podcast so be on the lookout for that soon!

“Screen Time” For Kids »

Posted on

On the latest episode of the Accidental Tech Podcast (ATP), there is good discussion around what constitutes screen time for kids and how each of the hosts handles it with their children. Marco mentions and makes a good point that with the ever increasing amount of screens that kids are growing up around it’s hard to avoid them completely, but all three guys agree that screens are fine in moderation, but it totally depends on what is being done on those screens (video games, reading, productive work / writing, etc).

Ross is almost 7 months old and he only gets to “watch” TV / YouTube for a small amount of time once and a while, but mainly because he thoroughly enjoys Elmo (especially with Adam Sandler) and simple songs, which hopefully help him to learn some new words in the process.

There is no standards or best practices for parenting and everyone has different views on how much “screen time” their kids should or shouldn’t have. Do what you feel is best for you & your children, but don’t automatically shun others based on their views because it may be what works for them and their family.

Toddler Stuff We Use »

Posted on

Ross just passed the 6-month mark and with us moving into a new house this post by Casey has been super helpful in helping us build a list of things Ross needs & would probably love.

Also, I had no idea those magnetic locks were a thing and they are so neat!

PS – isn’t his son Declan adorable?

I’m Ira Glass, Host of This American Life, and This Is How I Work »

Posted on

I occasionally listen to This American Life – it is probably one of the first things people think when they hear the word podcast, and this article over at Lifehacker is such a good read. Not only is there great work methodology, there is some humor in there as well.

Besides your phone and computer, what gadget can’t you live without and why?

I’d be lost without a toilet to dispose of human waste.