Skip to content

Instantly share code, notes, and snippets.

View drewdiver's full-sized avatar

tiredsince1985 drewdiver

View GitHub Profile
set processName to text returned of ¬
(display dialog ¬
"Enter process name" default answer ¬
"Preview" buttons {"OK", "Cancel"} default button 1)
tell application "System Events"
if exists (window 1 of process processName) then
tell process processName
set visible to true
return every UI element of front window
@drewdiver
drewdiver / 50-sound.conf
Created December 20, 2018 21:00
Fix sound on Lenovo L440 in Linux (Debian and OpenSUSE)
# add to /etc/modprobe.d/50-sound.conf
# changes default audio order, for some reason HDMI is picked up as main audio device.
options snd-hda-intel index=0 model=auto vid=8086 pid=8c20
options snd-hda-intel index=1 model=auto vid=8086 pid=0c0c
@drewdiver
drewdiver / fixWavesV9LogicProX.sh
Last active July 1, 2019 17:30
Removes the Audio Unit and Waves cache, checks the V9 folder exists and launches the AU Reg Util
#!/bin/sh
currentUser=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; \
username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; \
sys.stdout.write(username + "\n");')
wavesAURegUtil=/Applications/Waves/WaveShells\ V9/Waves\ AU\ Reg\ Utility1\ 9.92.app
# Make sure Logic isn't running
if ps aux | grep '[L]ogic' >> /dev/null 2>&1
@drewdiver
drewdiver / CupertinanRoulette.py
Last active October 18, 2019 08:47
A game of roulette, Cupertino style. Don't get shot...
#!/usr/bin/python
#
# Written by Drew Diver 2019
# Create a policy in Jamf to run the following script from Self Service.
#
# Inspired by https://twitter.com/lapcatsoftware/status/1182350562123227136?s=20
# Named by Armen Briegel
import random
import subprocess
tell application "Safari"
set tabURL to the URL of the current tab of window 1
set tabName to the name of the current tab of window 1
set the clipboard to "<a href=\"" & tabURL & "\">" & tabName & "</a>"
end tell
tell application "Safari"
set tabURL to the URL of the current tab of window 1
set tabName to the name of the current tab of window 1
set the clipboard to "[" & tabName & "](" & tabURL & ")"
end tell
@drewdiver
drewdiver / Generate UUID to Clipboard.applescript
Last active May 12, 2020 12:13
Generate a UUID to the macOS clipboard
set newUUID to do shell script "uuidgen"
set the clipboard to newUUID
@drewdiver
drewdiver / BBEdit - Distraction Free.applescript
Last active May 12, 2020 12:12
Simplify the current BBEdit window for Markdown editing
tell application "BBEdit"
tell front window
set show line numbers to false
set show gutter to true -- or false if you don't want to use folding
set show navigation bar to false
set show page guide to false
set soft wrap text to true
set soft wrap width to 80
set source language to "Markdown" -- or "Text File"
end tell
tell application "BBEdit"
tell front window
set currentProportion to (get split proportion)
if currentProportion is greater than 0 then
set split proportion to 0
else
set split proportion to 30
end if
end tell
end tell
@drewdiver
drewdiver / mas_setup.sh
Last active December 18, 2020 09:14
Install mas-cli and automate App Store installations.
#!/bin/bash
CURRENT_USER=$(stat -f %Su /dev/console)
CURRENT_USER_UID=$(id -u "$CURRENT_USER")
MAS_PKG=/private/tmp/mas.pkg
APP_LIST=(
441258766
955297617
409183694