Skip to content

Instantly share code, notes, and snippets.

@cvzi
cvzi / edge2browser.py
Last active July 14, 2020 09:47
Open Microsoft edge links with your default browser, prevent "get help with file explorer in windows 10" links from opening.
#!python3
r"""
Open Microsoft edge links with your default browser
Prevent "get help with file explorer in windows 10" links from opening.
Instructions:
1.
Download SetUserFTA.exe from https://docs.microsoft.com/en-us/archive/blogs/windowsinternals/windows-10-how-to-configure-file-associations-for-it-pros
@cvzi
cvzi / equalizeVolumeBalance.py
Created June 10, 2020 09:45
Set the volume level of all channels to the same volume.
"""
Sets the volume level of all channels to the same volume.
It chooses the minimum of all volume levels.
Requirements
- Windows 10
- pip install pycaw
"""
@cvzi
cvzi / MusicManagerFailedSongs.py
Last active March 30, 2020 10:40
Reads all failed uploads from Google Music Manager and creates a m3u playlist of the failed files. Optionally resets the failed songs in the MusicManager database, so they can be uploaded again
# Reads all failed uploads from Google Music Manager and creates a m3u playlist of the failed files.
# You should stop Music Manager program before executing this script!
# You may use this m3u playlist to transcode the files to another file format.
# MusicManager usually fails because it cannot transcode the file format, either because
# it does not recognize the format or because the file is corrupted.
# If the filenames stay the same after transcoding, you can activate the second part of the
# script. This will delete the failures from the MusicManager database and after a restart
# MusicManager will try to upload them again.
@cvzi
cvzi / MusicManagerAutoRestart.py
Created March 26, 2020 19:10
For some reason the Music Manager app (to upload music files to the Google Play Music cloud) keeps crashing on my computer. This script checks every 15 seconds if the Music Manager app is running and if not restarts it by running: start MusicManager.exe
# For some reason the Music Manager app (to upload music files to the
# Google Play Music cloud) keeps crashing on my computer.
# This script checks every 15 seconds if the Music Manager app is
# running and if not restarts it by running: start MusicManager.exe
# Python 3.8
import subprocess
import time
import os
@cvzi
cvzi / lru.go
Created November 19, 2019 20:21
A LRU "least recently used" cache in golang
// A LRU "least recently used" cache
package lru
import (
"container/list"
"fmt"
"sync"
)
// Cache represents a LRU consisting of a map as an index and a list to hold data and indicate the last recently used queue.
@cvzi
cvzi / base64encode.js
Last active October 24, 2019 11:52 — forked from stubbetje/base64.js
Base64 encode in javascript
function base64encode (s) {
// from https://gist.github.com/stubbetje/229984
const base64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split('')
const l = s.length
let o = ''
for (let i = 0; i < l; i++) {
const byte0 = s.charCodeAt(i++) & 0xff
const byte1 = s.charCodeAt(i++) & 0xff
const byte2 = s.charCodeAt(i) & 0xff
o += base64[byte0 >> 2]
@cvzi
cvzi / backupApks.py
Last active July 12, 2020 09:31
Backup all installed (third-party) .apk files from your Android phone to your computer. No root required.
"""
backupApks.py
Backup all installed (third-party) .apk files from your Android phone to your computer.
Requires adb/adb.exe in %path%. No root required.
You can download adb from here: https://developer.android.com/studio/releases/platform-tools.html
You should try to keep the phone screen on while downloading the apks, otherwise transfer speed might drop drastically.
"""
import os
@cvzi
cvzi / jwt_tools.py
Created March 15, 2019 13:09
Encode and decode JSON Web Token/JWT (with RS256) from private/public key files
"""
Encode and decode JSON Web Token/JWT (with RS256) from private/public key files
Requires https://cryptography.io:
pip install cryptography
"""
__author__ = 'cuzi'
__email__ = 'cuzi@openmail.cc'
__all__ = ['generate_jwt', 'validate_jwt']
@cvzi
cvzi / urlsigner.py
Last active January 15, 2021 13:24 — forked from christ0pher/gist:f2c4748a09ed31cf71a8
Google URL-signing and checking for Python3
from requests.packages.urllib3.util import parse_url
from urllib.parse import quote, unquote
import hashlib
import hmac
import base64
""" Sign and check a URL using the client_secret """
__author__ = 'christopher@levire.com, cuzi@openmail.cc'
@cvzi
cvzi / keybase.md
Created August 14, 2017 10:44
Keybase Proof

Keybase proof

I hereby claim:

  • I am cvzi on github.
  • I am cuzi (https://keybase.io/cuzi) on keybase.
  • I have a public key ASB03iWZUtMothedCRPSu1rJdlN9nXcT4liu4k39R5rZpQo

To claim this, I am signing this object: