Skip to content

Instantly share code, notes, and snippets.

@muyajil
muyajil / mp3_tagger.py
Created March 3, 2022 09:48
Set MP3 Tags on mp3 files based on folder structure
import os
import eyed3
for artist in []:
print(artist)
for album in filter(lambda x: not x.startswith("."), os.listdir(f"./{artist}")):
print(f"{artist}/{album}")
for song in filter(lambda x: x.endswith('mp3'), os.listdir(f"./{artist}/{album}/")):
try:
from pymediainfo import MediaInfo
import os
def get_absolute_paths(root_dir):
for dirpath, _, filenames in os.walk(root_dir):
for f in filenames:
yield os.path.abspath(os.path.join(dirpath, f))
def get_relevant_file_paths(root_dir):
file_paths = get_absolute_paths(root_dir)
repos:
- repo: https://github.com/Quantco/pre-commit-mirrors-flake8
rev: '' # Use the sha / tag you want to point at
hooks:
- id: flake8-conda
- repo: https://github.com/Quantco/pre-commit-mirrors-black
rev: '' # Use the sha / tag you want to point at
hooks:
- id: black-conda
- repo: local
@muyajil
muyajil / dcps.py
Created August 16, 2020 21:28
Display all docker-compose projects running in a summarized view
#!/usr/bin/python3
import subprocess
from tabulate import tabulate
out = subprocess.Popen(['docker','ps', '--format', '"table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.RunningFor}}\t{{.Ports}}"'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout, _ = out.communicate()
stdout = stdout.decode('utf-8')
lines = stdout.split('\n')
table = []
@muyajil
muyajil / set_slack_status_from_calendar.gs
Last active June 19, 2020 10:52
Set the slack status from your calendar
function setSlackStatusFromCalendar() {
var calendarId = PropertiesService.getScriptProperties().getProperty('CALENDAR_ID');
var calendar = CalendarApp.getCalendarById(calendarId);
var now = new Date();
var twoHoursFromNow = new Date(now.getTime() + (2 * 60 * 60 * 1000));
var events = calendar.getEvents(now, twoHoursFromNow);
if (events.length === 0){
setSlackStatus('free');
} else {
var away = false;
@muyajil
muyajil / dg_product_availability.py
Created May 26, 2020 18:56
Small script to get notified on slack if a product on digitec.ch or galaxus.ch is available again.
import requests
import json
SLACK_WEBHOOK = "<YOUR_SLACK_WEBHOOK>"
API = "https://www.galaxus.ch/api/v1/products/salesoffers?culture=de-ch"
PRODUCT_IDS = [12949433] # List of product ids to check
results = requests.post(API, json=PRODUCT_IDS).json()
for sales_offer_product in results['salesOffers']:
product_id = sales_offer_product['productId']
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@muyajil
muyajil / discogs_dump_to_csv.ipynb
Last active March 6, 2019 06:44
Generate CSV from discogs data dumps
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.