Skip to content

Instantly share code, notes, and snippets.

View KennethNielsen's full-sized avatar

Kenneth Nielsen KennethNielsen

  • Copenhagen, Denmark
View GitHub Profile
def __repr__(self):
kwarg = []
if self.key != self.name:
kwarg.append("key")
if self.primary_key:
kwarg.append("primary_key")
if not self.nullable:
kwarg.append("nullable")
if self.onupdate:
kwarg.append("onupdate")
@KennethNielsen
KennethNielsen / mailspring_fix_window.py
Created March 5, 2020 14:19
wmctrl fix for mailspring wrong screen
from time import sleep
from subprocess import CalledProcessError, check_output, check_call
mailspring_pid = None
while True:
try:
output = check_output(("wmctrl", "-l", "-p", "-G")).decode("UTF-8")
except CalledProcessError:
pass
@KennethNielsen
KennethNielsen / hours.py
Created October 11, 2019 08:37
Quick and dirty script for calculating hours balance from Watson output
#!/usr/bin/env python3
import subprocess
import sys
import arrow
import argparse
from json import loads
from pprint import pprint
from collections import Counter, defaultdict
@KennethNielsen
KennethNielsen / list_actions.py
Last active May 6, 2016 07:50
List all actions available from Sonos via SoCo
from __future__ import print_function
import inspect
import soco
zone = soco.discovery.any_soco()
# Get the base service class
service_class = soco.services.Service
@KennethNielsen
KennethNielsen / test_ms.py
Created March 4, 2015 21:15
New music service test script
# -*- coding: utf-8 -*-
from __future__ import print_function
from pprint import pprint
import time
import traceback
from soco import SoCo
import soco
from soco.music_services import MusicService
# -*- coding: utf-8 -*-
from __future__ import print_function
from pprint import pprint
import time
import traceback
from soco import SoCo
import soco
from soco.music_services import MusicService