Skip to content

Instantly share code, notes, and snippets.

View goerz's full-sized avatar

Michael Goerz goerz

View GitHub Profile
@albertbori
albertbori / Installation.md
Last active June 11, 2024 14:09
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
@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:

@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active June 2, 2024 11:23
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

@XVilka
XVilka / TrueColour.md
Last active June 10, 2024 17:21
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@wcaleb
wcaleb / ocrpdf.sh
Created November 6, 2013 14:41
Take a PDF, OCR it, and add OCR Text as background layer to original PDF to make it searchable
#!/bin/sh
# Take a PDF, OCR it, and add OCR Text as background layer to original PDF to make it searchable.
# Hacked together using tips from these websites:
# http://www.jlaundry.com/2012/ocr-a-scanned-pdf-with-tesseract/
# http://askubuntu.com/questions/27097/how-to-print-a-regular-file-to-pdf-from-command-line
# Dependencies: pdftk, tesseract, imagemagick, enscript, ps2pdf
# Would be nice to use hocr2pdf instead so that the text lines up with the PDF image.
# http://www.exactcode.com/site/open_source/exactimage/hocr2pdf/
@goerz
goerz / quicksort.py
Created November 3, 2013 03:42
A reference implementation of the Quicksort algorithm. Should be easy to translate to other languages.
#!/usr/bin/env python
""" Reference implementation of Quicksort on an integer array """
__author__ = 'Michael Goerz'
import numpy as np
import numpy.random as nprnd
import random
import math
@yourcelf
yourcelf / tex-conversions.py
Created July 22, 2013 17:39
Convert utf-8 encoded unicode characters to latex escape sequences. I use this for pre-processing bibtex exports from zotero. Usage: tex-conversions.py infile > outfile
# Obtained from http://code.activestate.com/recipes/252124-latex-codec/
latex_equivalents = {
0x0009: ' ',
0x000a: '\n',
0x0023: '{\#}',
0x0026: '{\&}',
0x00a0: '{~}',
0x00a1: '{!`}',
0x00a2: '{\\not{c}}',
0x00a3: '{\\pounds}',
@goerz
goerz / pre-commit
Created November 3, 2012 12:03
Default git pre-commit hook
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, make this file executable.
# This is slightly modified from Andrew Morton's Perfect Patch.
@ganwell
ganwell / logspec.py
Created September 23, 2012 16:08
Pylab spectogram with log. frequency scale
import numpy
import scipy
import matplotlib.pyplot as pyplot
def decibel(lin):
"""Convert amplitude to decibel.
We might later need power to decibel..."""
return 20*numpy.log10(norm(lin))
@joshwand
joshwand / gist:1145669
Created August 15, 2011 03:41
Blocking the new version of the NYTimes paywall

The NYTimes has updated their paywall-- it's slightly more sophisticated. The content is no longer hidden behind a big transparent div, but instead is now actually removed from the page entirely. It's still simple to defeat, though. Using adblock plus (or your preferred adblocking device), block the following URLs:

*://*.nytimes.com/*/gwy.js*
*://*.nytimes.com/*/gw.js*

And you're done.