Skip to content

Instantly share code, notes, and snippets.

View goerz's full-sized avatar

Michael Goerz goerz

View GitHub Profile
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 10, 2025 09:21
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@kroo
kroo / README.md
Last active June 26, 2017 18:11
A quick n' dirty hack to fix a dying GrowlVoice

How to Use

Open up Terminal.app in your /Applications/Utilities directory, then type in these commands, one after each other:

  1. Create a temporary directory for cycript:

    mkdir cycript && cd cycript
    
  2. Pull the latest cycript from cycript.org:

@albertbori
albertbori / Installation.md
Last active April 9, 2025 08:52
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
@goerz
goerz / doc2markdown.py
Created July 24, 2015 14:44
Convert a word (doc/docx) file to markdown
#!/usr/bin/env python
"""Convert a word (doc/docx) file to markdown"""
import sys
import os
import subprocess
SOFFICE = r'/Applications/LibreOffice.app/Contents/MacOS/soffice'
PANDOC = r'pandoc'
@goerz
goerz / 00_GPG_and_SSH_README.md
Last active December 28, 2018 19:43
Public SSH/GPG keys

Public SSH/GPG Keys

If you would like to give me SSH access to a machine, please append the content of goerz.pub to the ~/.ssh/authorized_keys file.

To send me encrypted files (attachments) by email, use the GPG Key 57a6caa6.asc.

You can verify the GPG keys at https://keybase.io/goerz

@goerz
goerz / rename_amtrak.py
Created February 19, 2016 21:21
Rename Amtrak Tickets
#!/usr/bin/env python
"""command line script that renames a bunch of Amtrak ticket PDF to a more
useful name. Relies on `pdftotext`."""
import os
import re
import logging
from collections import namedtuple
from dateutil.parser import parse as parse_date
from glob import glob
@goerz
goerz / TLS_dissipator_superop.ipynb
Last active January 24, 2017 19:27
The Dissipator of a Two-Level-System as an Explicit Superoperator
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JonnyWong16
JonnyWong16 / sync_playlists_to_users.py
Last active April 8, 2025 20:09
Sync Plex playlists to shared users.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Description: Sync Plex playlists to shared users.
# Author: /u/SwiftPanda16
# Requires: plexapi
from plexapi.exceptions import NotFound
from plexapi.server import PlexServer
@goerz
goerz / render_sympy_tree.py
Created March 28, 2017 17:55
Render Sympy Expression as graphical tree inside IPython notebook
def render_sympy_tree(expr):
"""Render the given Sympy Expression as a graphical tree, inside an IPython notebook"""
from sympy.printing.dot import dotprint
import tempfile
import subprocess
import os
from IPython.display import SVG
with tempfile.NamedTemporaryFile(mode='w', delete=False) as out_fh:
out_fh.write(dotprint(expr))
subprocess.run(['/usr/bin/dot', '-Tsvg', out_fh.name, '-o', out_fh.name + ".svg"])
@mdonkers
mdonkers / server.py
Last active April 4, 2025 13:11
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer