Skip to content

Instantly share code, notes, and snippets.

simon-weber /
Created August 28, 2020 16:03
Import Google Music playcount and last played to MediaMonkey

This Python 3 script imports some Google Music metadata to MediaMonkey. Matches are found by a complete match of the song name, album, and artist.

To use it:

  • shut down MediaMonkey
  • make a copy of your MM.DB MediaMonkey database and put it in the same directory as this script
  • use the Autoplaylists for Google Music debug interface to generate a csv of your library, then place it in the same directory as this script and name it google_music_library.csv
  • run python and investigate the logs; repeat on a fresh copy of MM.DB each time until satisfied
  • back up your existing MM.DB and then overwrite it with the modified one
simon-weber /
Created June 15, 2017 22:06
disabling profiling around python-libfaketime example
# An example to disable profiling when faking time with python-libfaketime.
# Call this once from setup_package or a similar hook at the start of the test run.
def disable_profiling_around_libfaketime(nose_config):
libfaketime's interception of time system calls will break profilers.
If we detect that we're running under a profiler, we set up libfaketime callbacks to
temporarily disable profiling when we're faking the time.
simon-weber / example.js
Created November 22, 2016 22:39
lovefield query/index/order bug example
document.write = function (s) {
// jsfiddle doesn't allow document.write.
document.body.insertAdjacentHTML("beforeend", s);
const schemaBuilder = lf.schema.create('schema', 1);
addColumn('id', lf.Type.INTEGER).
addColumn('num', lf.Type.STRING).
simon-weber /
Created August 26, 2016 19:28
disable ASG scaling processes during CodeDeploy deploys
Suspend an auto scaling group's scaling processes that can interfere with CodeDeploy deploys.
It assumes a single ASG per deployment group.
To use this:
* create a lambda function with this code, then hook up it up to an SNS topic that receives all deployment events (but not host events).
* attach that topic as a trigger in your deployment groups.
Unlike AWS's in-appspec approach, this supports arbitrary deploy concurrency.
simon-weber /
Last active April 16, 2017 19:04 — forked from tgsoverly/
Merge Cobertura XML's
import sys
import os
import xml.etree.ElementTree as ET
import logging
import re
from shutil import copyfile
from optparse import OptionParser
### This file came from the repo they were nice enough to spend time to write this.
### It is copied here for other people to use on its own.
simon-weber /
Created July 30, 2015 15:51
recursively get all downstream jenkins artifact urls
#!/usr/bin/env python
Run on Jenkins to print a url for each artifact generated by a downstream multijob build.
import os
import requests
simon-weber /
Created July 29, 2015 19:47
venmo linting pre-commit
GITROOT=`git rev-parse --show-toplevel`
# Lint all the files in the index, excluding deletions and directories.
git diff-index -z --cached --name-only --diff-filter='ACMRTUXB' HEAD | xargs -0 ls -dp | grep -v '/$' | xargs "$GITROOT/lint"
if [ "$?" != "0" ]; then
simon-weber /
Created July 29, 2015 15:25
toplevel venmo linting script
#!/usr/bin/env bash
# Usage:
# lint [file1] [file2]...
# With no arguments, lint any tracked files with modifications.
# Get into the path so that git-lint detects it.
simon-weber / script.js
Last active August 29, 2015 14:07
indicate gmail focus
function is_non_inbox_node(node){
var is_non_inbox = false;
if (node.isContentEditable ||
node.tagName == 'INPUT' ||
node.tagName == 'TEXTAREA' ||
node.getAttribute('aria-haspopup') == 'true'
is_non_inbox = true;
simon-weber /
Last active November 24, 2018 21:52
Custom tooling to ease management.
import vcrutils
VCR_CASSETTE_PATH = APPROOT + '/venmo_tests/cassettes/' # eg
@dual_decorator # convert a paramaterized decorator for no-arg use (
def external_call(*args, **kwargs):
"""Enable vcrpy to store/mock http requests.