Skip to content

Instantly share code, notes, and snippets.

View rothmichaels's full-sized avatar

Roth Michaels rothmichaels

View GitHub Profile
@rothmichaels
rothmichaels / SpotifyAntiVacuum
Last active November 9, 2016 22:04
Removes SQLite VACUUM command references from Spotify
#!/usr/bin/python
target = "/Applications/Spotify.app/Contents/MacOS/Spotify"
with open(target) as infile:
bytes = infile.read()
with open("./Spotify", "wb") as backup:
backup.write(bytes)
fixed = bytes.replace("VACUUM;", "xxxxxx;")
with open (target, "wb") as outfile:
outfile.write(fixed)
@rothmichaels
rothmichaels / note
Created November 6, 2016 17:31
Quick notes on the command line
#!/bin/sh
OUTFILE="$HOME/Dropbox/org/notes-$(date '+%Y%m%d').txt"
cat >> "$OUTFILE"
(defun gnus-user-format-function-t (dummy)
(case (car gnus-tmp-method)
(nnimap
(let ((count (nnimap-request-message-count gnus-tmp-qualified-group)))
(if count
(format "%d" count)
"?")))
(t
gnus-tmp-number-total)))
@rothmichaels
rothmichaels / .dir-locals.el
Last active July 6, 2016 21:44
Django .dir-locals.el example
((python-mode
(python-shell-interpreter-args . "/PATH/TO/PROJECT/manage.py shell")
(python-shell-virtualenv-path . "/PATH/TO/VIRTUALENV")))
@rothmichaels
rothmichaels / public.gpg
Created May 22, 2016 20:14
Roth Michaels PGP Key (0x4afa275ef3c6ff5c)
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2
mQINBFc2KHoBEACogEJho6tXrJdzBOzx/jkcUXfvVEEeubdk1qtCxpezJAxea1HE
Ces3rgQE5DcCeBPtaYJnf/iqAOiqKN7aLbbsnYJYaWwPqKwn5O8jge4y6nofcQ6j
TLADHXxu3znZ0NXLy3Pqm0aZ8Y3IQ8MMwQAl/68NKjAWxd1p2HK5TBSwlpVONEYh
aqTN3cwRfzJsC4OKOM+L0Op47s13Xlb3gxWoiMzDnvOdVukc0FkrqH5NruMOufsT
owUJ9r54xVBvTY3CHyfhTfIkMNOnhxqGJdGOMO9E5cWpo4jsIPGNqgLv5VRZtSTX
Ign7aT0e+DOeC5ybQDpomocGzmztfnPXuNJ1CtFt2G53zKkqej367XmZic7UMXUU
HaGmINpO7hbM8gEH0cya4antWExZ3cvjCTEbuAUaxr7VdJGbWboiVlNqu6Q//8hg
@rothmichaels
rothmichaels / .gnus.el
Last active July 29, 2016 22:14
Gnus Configuration
(setq user-full-name "Roth Michaels"
user-mail-address "roth@rothmichaels.us")
(setq my-email-addresses '("roth@rothmichaels.us"
"roth@wasabihut.com"
"roth@myble.net"
"roth@sohoko.io"))
(setq message-alternative-emails (regexp-opt my-email-addresses))
@rothmichaels
rothmichaels / TableViewDataSourceExample.swift
Last active October 4, 2022 11:20
Enumerated UITableViewCell identifier example
import UIKit
/// Protocol to be implemented by table view cell identifier enums
protocol TableViewCellIdentifier {
var identifierString: String { get }
}
/// Extension to provide default impementation for RawRepresentable String enums
extension TableViewCellIdentifier where Self: RawRepresentable, Self.RawValue == String {
var identifierString: String {
@rothmichaels
rothmichaels / *scratch*.el
Last active May 17, 2016 20:53
In progress emacs shell-script-mode settings
(setq sh-basic-offset 2 sh-indentation 2)
(setq sh-indent-for-case-label 0)
(setq sh-indent-for-case-alt '+)
@rothmichaels
rothmichaels / Create iOS Icons.jsx
Last active May 24, 2016 20:26 — forked from twonjosh/Create iOS Icons.jsx
Photoshop Script to Create iOS Icons from a source image
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com
@rothmichaels
rothmichaels / GenericExample-MagicValue.swift
Last active November 12, 2015 14:36
Getting the Type from a generic
func magicValue<T>() -> T? {
let type = T.self
switch type {
case _ where type == String.self:
return "hello, world" as? T
case _ where type == Int.self:
// Ask for a number and get the answer to life, the universe, and everything
return 42 as? T
default:
return nil