Skip to content

Instantly share code, notes, and snippets.

Quick and dirty Spotify playlist export:

  1. Login to the Spotify web client
  2. Open the Developer Tools (Click on the Kebab Menu -> More Tools -> Developer Tools) and then click on the Network tab
  3. Click on a Playlist in the browser Window
  4. In the Network tab, look for a request to tracks?...
  5. Right-click the request, and select Copy -> Copy as cURL (bash)
  6. Paste the request into a bash shell and append |jq -r '.items[] | "\(.track.name)|\(.track.album.name)|\(.track.artists | map(.name) | join(","))"' This should produce a list of the tracks in the playlist with the song, album, and artist(s) separated by a pipe (|)
@ryanpersaud
ryanpersaud / keepass_csv_to_1password.py
Last active March 7, 2020 13:26
Converts KeePass 1.x CSV to 1Password compatible CSV
# Adapted from https://stackoverflow.com/questions/51397083/python-3-6-rename-column-header-using-dictwriter
import csv
order = ['Account', 'Web Site', 'Login Name', 'Password', 'Comments', 'Member Number', 'Recovery Codes']
# define renamed columns via dictionary
renamer = {'Account': 'Title', 'Web Site' : 'Website', 'Login Name':'Username', 'Comments':'Notes'}
# define column names after renaming
@ryanpersaud
ryanpersaud / HDF 2.1 Error
Last active January 23, 2019 21:25
Error encountered when attempting to launch Storm topology with HDF 2.1
Darrell Kienzle noted the following:
I downloaded HDF 2.1 and tweaked my vagrant rig to load all the new stuff from HDF instead of HDP. There was one less storm dependency
on HDF – no need for the “atlas_metadata” which HDP includes & requires. Anyway, when I tried to run the parser, I got the exception
below.
Long story short, it _looks_ like the submission is a two-step process now. First, it tries to do some fixups in
ClientJarTransformerRunner” and output a tmp jar in /tmp. This is per:
• STORM-1202: Migrate APIs to org.apache.storm, but try to provide some form of backwards compatability
@ryanpersaud
ryanpersaud / gist:734b68e3624d06433deaa114acc33865
Last active May 26, 2016 16:36
A NiFi template for the ExecuteScript processor that uses Jython to convert string timestamps to longs in JSON. Based on @mattyb149's template (https://gist.github.com/mattyb149/89205fcbc6d0e15ba024)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template>
<description>Converts string timestamps to long in JSON.
</description>
<name>ConvertStringTimestampsToLong</name>
<snippet>
<processors>
<id>c6cf8df9-bfcf-45e9-ab06-76de85e78f78</id>
<parentGroupId>a27e19b1-ef3e-41a2-b0ce-266370b14b47</parentGroupId>
<position>
@ryanpersaud
ryanpersaud / gist:7c11e0ee00bb8fc53b50
Last active August 29, 2015 14:24
clojure.lang.Reflector.getMethods()
static final ConcurrentHashMap<String, List> getMethodsCache = new ConcurrentHashMap<String, List>();
static public List getMethods(Class c, int arity, String name, boolean getStatics){
// Build the cache key
String key = c.getName() + String.valueOf(arity) + name + String.valueOf(getStatics);
// Check the cache
ArrayList methods = getMethodsCache.get();
if(methods != null) {