Skip to content

Instantly share code, notes, and snippets.

View mattkohl's full-sized avatar
🌀
. . .

Matt Kohl mattkohl

🌀
. . .
View GitHub Profile
@mattkohl
mattkohl / instance_to_dict.py
Created June 5, 2017 11:19
Overloading __iter__
class MyClass:
def __init__(self, a, b, c):
self.value_1 = a
self.value_2 = b
self.value_3 = c
def __iter__(self):
""" enables dict(object) functionality """
yield "key1", self.value_1
@mattkohl
mattkohl / readme.md
Created August 14, 2017 09:03 — forked from shaun-stripe/readme.md
texas flag emoji for Slack
@mattkohl
mattkohl / update-slack-status-from-spotify.sh
Created March 12, 2018 13:04 — forked from kfox/update-slack-status-from-spotify.sh
Updates your Slack status with the current artist and song title in Spotify
#!/usr/bin/env bash
: "${SLACK_API_TOKEN:?Need to set SLACK_API_TOKEN environment variable}"
STATUS=$(/usr/bin/osascript <<"EOF"
if application "Spotify" is running and application "Slack" is running then
tell application "Spotify"
set currentArtist to artist of current track as string
set currentSong to name of current track as string
return currentArtist & " - " & currentSong