Skip to content

Instantly share code, notes, and snippets.

@ECHO OFF
ECHO ----------------------------------------------------------
ECHO Google Drive FS - Silent Change Mountpoint Utility v0.0001
ECHO ----------------------------------------------------------
REM Scripted: Marc Vandael - 25/01/2018
REM Change the var _mountpoint to whatever driveletter you would like.
REM If the letter is in use, the next free one will be used.
REM This attempts to write to HKLM & HKCU so admin rights are needed for this to work.
@rmanly
rmanly / livestreammonitor.py
Last active February 18, 2016 18:11 — forked from sinkers/livestreammonitor.py
Script for live video streaming monitoring with notifications
#!/usr/bin/python
'''
Script to monitor live streams and send an Amazon SNS if the stream is down (and possibly take restorative action)
Future:
Black detect: ffmpeg -i out.mp4 -vf blackdetect -f null -
Note the following doesn't seem to fully work without looking at the debug logs
On live ffmpeg -y -i rtmp://cp30129.live.edgefcs.net/live/videoops-videoops@50541 -vf blackdetect -t 10 -loglevel debug -f null -
'''
#!/bin/bash
[ -z "$1" ] && echo "This script requires a path to output the app icons in PNG format."
# Use /usr/bin/sips to copy the app icon out of the App bundle for each of the Adobe CC products
# and convert into png format
# Acrobat Pro 11
APP="/Applications/Adobe Acrobat DC/Adobe Acrobat.app"
APP_ICON="ACP_App.icns"
#!/bin/bash
# looks like they changed they name again
# https://groups.google.com/forum/#!topic/munki-dev/w38roCmEgH0
# I have 11.2.1.203 and it is now just 'shoe'
# Copy the com.avid.bsd.shoe Helper Tool
PHT_SHOE="/Library/PrivilegedHelperTools/com.avid.bsd.shoe"
/bin/cp "/Applications/Pro Tools.app/Contents/Library/LaunchServices/com.avid.bsd.shoe" $PHT_SHOE

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
# Banner-style (default)
from Foundation import NSUserNotification, NSUserNotificationCenter
def notify(title, subtitle, text):
notification = NSUserNotification.alloc().init()
notification.setTitle_(str(title))
notification.setSubtitle_(str(subtitle))
notification.setInformativeText_(str(text))
notification.setSoundName_("NSUserNotificationDefaultSoundName")
NSUserNotificationCenter.defaultUserNotificationCenter().scheduleNotification_(notification)
@rmanly
rmanly / SoundcloudDL.py
Created November 22, 2013 20:55 — forked from pudquick/SoundcloudDL.py
changed iDownloads:// to ghttp:// for downloading via Goodreader
import requests, random, datetime, sys, webbrowser, console
def main():
song_page = None
if (len(sys.argv) > 0):
try:
song_page = sys.argv[1]
except Exception:
song_page = None
if not song_page:
@rmanly
rmanly / YoutubeDL.py
Created November 22, 2013 20:54 — forked from pudquick/YoutubeDL.py
changed iDownloads:// to ghttp:// for downloading via Goodreader
import urllib2, urlparse, sys, webbrowser
itags = {'45': 'webm_720p',
'44': 'webm_480p',
'43': 'webm_360p',
'38': 'mp4_3072p',
'37': 'mp4_1080p',
'36': 'phone_mp4_240p',
'35': 'flv_480p',
'34': 'flv_360p',
import urllib2, urlparse, sys, webbrowser
itags = {'45': 'webm_720p',
'44': 'webm_480p',
'43': 'webm_360p',
'38': 'mp4_3072p',
'37': 'mp4_1080p',
'36': 'phone_mp4_240p',
'35': 'flv_480p',
'34': 'flv_360p',
import re, urllib2, json, webbrowser, console, SimpleHTTPServer, SocketServer, sys
html_template = """
<html><head><title>Updates</title>
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<style media="all">
::-webkit-scrollbar { width: 1px; }
html { width: 100%%; height: 100%%; margin: 0; padding: 0; }
body {
font: normal normal normal 13px/1.5 'Helvetica Neue',Arial,Helvetica,sans-serif;