Skip to content

Instantly share code, notes, and snippets.

View christianmondabon's full-sized avatar

Christian Mondabon christianmondabon

View GitHub Profile
@christianmondabon
christianmondabon / clean.bash
Created May 2, 2019 10:55
Delete previously synced files which are not on a YouTube playlist anymore (see youtube-playlist-sync project)
#!/bin/bash
/usr/local/bin/youtube-dl -j --flat-playlist --restrict-filenames "YOUTUBE-PLAYLIST-URL" | cut -d'"' -f4 | xargs -I "{}" -n 1 find FILELOCATION -type f -name '*{}*' | sort | comm -23 <(find $FILELOCATION -type f | sort) - | grep -v yps.json | xargs -I "{}" rm '{}'
@christianmondabon
christianmondabon / pushover.py
Last active April 19, 2018 14:07
send pushover message (message is 1st command line parameter)
import http.client, urllib
conn = http.client.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.parse.urlencode({
"token": "APP_TOKEN",
"user": "USER_KEY",
"message": str(sys.argv[1]),
}), { "Content-type": "application/x-www-form-urlencoded" })
conn.getresponse()
@christianmondabon
christianmondabon / sendmail.py
Last active May 8, 2018 14:38
Send E-Mail with a Python script
import smtplib
import ssl
from email.mime.text import MIMEText
# Create message
message = MIMEText("TEXT")
message['Subject'] = "SUBJECT"
message['From'] = "YOUR GMAIL ADDRESS"
message['To'] = "RECIPIENT EMAIL ADDRESS"
@christianmondabon
christianmondabon / CrushPNGs.txt
Last active September 9, 2016 07:02
Automatically minimize PNG size
Caution: This oneliner replaces all PNG in current directory and all subdirectories!
Fast and nearly optimal size (use this!):
find . -name '*.png' -print0 | xargs -0 optipng -o2 -strip all
Slow and optimal size:
find . -name '*.png' -print0 | xargs -0 optipng -o7 -strip all

Keybase proof

I hereby claim:

  • I am christianmondabon on github.
  • I am moe (https://keybase.io/moe) on keybase.
  • I have a public key whose fingerprint is E0D4 F9F1 F481 AA10 E390 02BC 928B 8B5F 79F3 D348

To claim this, I am signing this object: