Skip to content

Instantly share code, notes, and snippets.

@g2p
g2p / export-shazam-web.js
Last active January 21, 2023 14:41 — forked from hennzen/export-shazam-web.js
Export Shazam list to JSON format
// JS-Console script to export song name, artist and cover image URL to a JSON format
// Order of results is in ascending date order. If you want to change that, delete line with '.reverse()'
// The result is copied to your clipboard
//
// 1. Open https://www.shazam.com/myshazam and login
// 2. Scroll down to the end of your list, so that *all* songs are loaded
// 3. Open Developer console with F12
// 4. Copy paste this code to the JS-console and hit Enter
// 5. Paste the result to your favorite text editor. Voilà.
@krzyzanowskim
krzyzanowskim / StringGetSizeThatFits.swift
Last active November 12, 2023 14:51
Calculate frame of String, that fits given width
// Excerpt from https://github.com/krzyzanowskim/CoreTextWorkshop
// Licence BSD-2 clause
// Marcin Krzyzanowski [email protected]
func getSizeThatFits(_ attributedString: NSAttributedString, maxWidth: CGFloat) -> CGSize {
let framesetter = CTFramesetterCreateWithAttributedString(attributedString)
let rectPath = CGRect(origin: .zero, size: CGSize(width: maxWidth, height: 50000))
let ctFrame = CTFramesetterCreateFrame(framesetter, CFRange(), CGPath(rect: rectPath, transform: nil), nil)
@brandonjp
brandonjp / dMCFileNameChrReplace.md
Last active February 15, 2023 12:53
dBpoweramp Music Converter - XRegistry for Restricted Filename Character Replacements on macOS

Accent Marks in dBpoweramp Music Converter

I've had a huge problem with a variety of diacritics / accent marks in filenames. I lost a few files because I didn't notice that Dropbox had failed to sync umlauts and a few more rare characters between operating systems. So pulling from this list: http://pinyin.info/unicode/diacritics.html - I created a set of filename character replacements for dMC settings. This will replace any diacriticals with the closest unaccented latin character. It's been a game changer for me, posting it here in case it helps anyone else (and probably so I can find it again in a couple years). This is how I've changed it on macOS, I'm not sure about Windows.

Replacement Settings for MacOS

  • First, completely quit any dBpoweramp programs that are running.
  • Then find the registry file at: ~/Library/dBpoweramp/XRegistry and open it in a text editor.
  • Look for the key "dMCFileNameChrReplace" (If you have current replacements set, you might want to copy them to a blank text
@hennzen
hennzen / export-shazam-web.js
Last active September 29, 2024 04:31
Export Shazam list to JSON format
// JS-Console script to export song name, artist and cover image URL to a JSON format
// Order of results is in ascending date order. If you want to change that, delete line with '.reverse()'
// The result is copied to your clipboard
//
// 1. Open https://www.shazam.com/myshazam and login
// 2. Scroll down to the end of your list, so that *all* songs are loaded
// 3. Open Developer console with F12
// 4. Copy paste this code to the JS-console and hit Enter
// 5. Paste the result to your favorite text editor. Voilà.
@joanbono
joanbono / macdown_brute.sh
Last active January 7, 2024 11:12
mac-torrent-download DMG brute-forcer
#!/bin/bash
# Title: Macdown.sh
# Description: Bruteforce DMG files downloaded from mac-torrent-download.net
# Author: Joan Bono (@joan_bono)
# Version: 1.1.0
# Last Modified: jbono @ 20211129
RED='\033[0;31m'
GREEN='\033[0;32m'
NOCOLOR='\033[0m'
// Marcin Krzyzanowski
// blog.krzyzanowskim.com
import Foundation
extension URLResourceKey {
static let bookmarkAllPropertiesKey = URLResourceKey("NSURLBookmarkAllPropertiesKey")
static let fileIDKey = URLResourceKey("_NSURLFileIDKey")
static let inode = URLResourceKey.fileIDKey
}
@jasantunes
jasantunes / find-recently-modified-files.sh
Created February 15, 2019 07:08
Show recently modified files.
# To get a list of the files that were most recently modified:
find $* -type f -printf "%TY-%Tm-%Td %TH:%TM %p\n" | sort -r -n | head
# If you want to ignore files in hidden directories (that start with dot), such as eclipse metadata files, use:
find $* -not \( -type d -name ".*" -prune \) -and -type f -printf "%TY-%Tm-%Td %TH:%TM %p\n" | sort -r -n | head
@jasantunes
jasantunes / SyncRatings0.1.scpt
Created February 7, 2019 07:59
iTunes sync ratings (deprecated)
(*
Author: Joao Antunes
Version: 0.1
*)
property database_file : "Library:iTunes:Scripts:index_ratings.txt"
property SET_ENCODING : "export LANG=en_US.UTF-8; "
on run
set FILEDB to POSIX path of ((path to home folder as string) & database_file)
@EderSantana
EderSantana / Spotify2AppleMusic.md
Last active June 29, 2020 08:16
Updated insert_songs.py from spotify2am

Follow the general instructions at https://github.com/simonschellaert/spotify2am .
This will export your Spotify playlist to csv and add the songs to your iTunes Library.

Notes:
For the proxy part I used https://mitmproxy.org/ instead of Charles. Charles isn't free.

mitmproxy is fairly easy to use, just don't forget to setup your HTTPS proxy server at 127.0.0.1 port 8080 (Settings -> Network -> Advanced -> Proxies).

If the insert_songs.py step doesn't work for you, try the one in this gist.
Note the TODO:REPLACE_THIS , you will get that info on mitmproxy when you add a new song from Apple Music to your Library.

@wolkenarchitekt
wolkenarchitekt / traktor_rating.py
Last active June 29, 2020 06:58
Get/set popularimeter rating ID3 tag for Traktor
# Gets or sets popularimeter ID3 rating tag for Traktor.
# Needs mutagen for ID3 tag manipulation:
# pip install mutagen
import logging
import os
import sys
import click
import mutagen
import mutagen.id3