Skip to content

Instantly share code, notes, and snippets.

@lucascantor
lucascantor / authrestart.sh
Last active September 30, 2020 15:11
The fdesetup utility can be used to remotely restart a Mac without needing physical in-person keyboard access to unlock FileVault on the next boot only
fdesetup authrestart
@thorsten
thorsten / setUserAgent.js
Created May 9, 2016 15:12
Override user agent on all browsers
function setUserAgent(window, userAgent) {
// Works on Firefox, Chrome, Opera and IE9+
if (navigator.__defineGetter__) {
navigator.__defineGetter__('userAgent', function () {
return userAgent;
});
} else if (Object.defineProperty) {
Object.defineProperty(navigator, 'userAgent', {
get: function () {
return userAgent;
@chockenberry
chockenberry / finder_icons.sh
Last active February 10, 2024 19:05
A simple shell script to turn the Finders desktop icons on and off
#!/bin/sh
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1
enabled=$?
if [ "$1" = "off" ]; then
if [ $enabled -eq 1 ]; then
defaults write com.apple.finder CreateDesktop false
osascript -e 'tell application "Finder" to quit'
open -a Finder
@philgruneich
philgruneich / Complete Reminder.py
Created March 20, 2016 18:56 — forked from anonymous/Complete Reminder.py
Complete Reminder.py
# coding: utf-8
import reminders
import sys
import dialogs
import webbrowser
from urllib import quote
def completeReminder():
@philgruneich
philgruneich / MovieDiaryConfig.py
Created February 23, 2016 01:42 — forked from anonymous/MovieDiaryConfig.py
MovieDiaryConfig.py
# coding: utf-8
import dialogs
import keychain
import console
import cPickle
from urllib import quote, unquote
class NoConfigError (Exception): pass
class MissingConfigError (Exception): pass
@philgruneich
philgruneich / FixMovieDiary.py
Created February 20, 2016 23:01 — forked from anonymous/FixMovieDiary.py
FixMovieDiary.py
# coding: utf-8
import keychain
import console
from urllib import quote, unquote
keychain.set_password('MovieDB', 'API', console.input_alert('Insert your MovieDB API key', '', keychain.get_password('MovieDB', 'API')))
keychain.set_password('Airtable', 'API', console.input_alert('Insert your Airtable API key', '', keychain.get_password('Airtable', 'API')))
keychain.set_password('Airtable', 'Movie Diary', console.input_alert('Insert your Airtable database ID', '', keychain.get_password('Airtable', 'Movie Diary')))
keychain.set_password('Airtable', 'Movie Diary Table', quote(console.input_alert('Insert the name of your Airtable table', '', unquote(keychain.get_password('Airtable', 'Movie Diary Table')))))
@philgruneich
philgruneich / Movie Diary.py
Last active January 18, 2019 06:37 — forked from anonymous/Movie Diary.py
Movie Diary.py
#!/usr/bin/env/python2
# coding: utf-8
import requests
import json
import appex
import dialogs
import re
import datetime
import keychain
@JMichaelTX
JMichaelTX / JXA Resources.md
Last active April 15, 2025 04:32
JavaScript for Automation (JXA) Resources

JXA Resources

Revised: 2019-11-28 16:16 GMT-6

JXA

This is a list of the key resources I have found useful. If you know of others, please post in a comment below, and I will add to this list.

I have tried to order this list in the order that, to me, is best for learning JXA from scratch. We all learn a bit diferently, so adjust to suit your style/needs. Please post if you have suggestions on learning JXA.

@philgruneich
philgruneich / OCRtoInteract.py
Last active March 17, 2020 00:28
Requires Pythonista for iOS and Interact for iOS. Sends image and returns OCR'd text. Opens text in Interact unless used from action extension, then adds to clipboard.
# coding: utf-8
import requests
import photos
from PIL import Image, ImageEnhance
import StringIO
import appex
import console
import json
import keychain
In the next version of iPulse, I'd like to show GPU statistics. Unfortunately, the format
for these statistics is vendor specfic (see the "Performance Statistics" dictionary below.)
In order to cover as many devices as possible, I'd like you to run the following commands
from your Terminal:
$ sysctl hw.model
$ ioreg -r -d 1 -w 0 -c "IOAccelerator"
You can help me read the results by putting them in a code block (triple backticks).