Skip to content

Instantly share code, notes, and snippets.

@Diegus83
Diegus83 / Mac OS X Lion installer.txt
Last active February 9, 2024 14:16
Makes one Bootable USB Lion installer from Apple's provided PKG (2021)
# This is not intended to be guide, I just wrote it as a reminder to myself of the steps necessary.
# If you find it useful, that's great, but keep in mind the paths and device ID's will need
# to be adjusted to your case. And you may need sudo if you are not doing this while booted from recovery like I did.
Get the InstallMacOSX.dmg from https://support.apple.com/kb/DL2077?locale=en_US
Mount the image
hdiutil mount InstallMacOSX.dmg
cd /Volumes/Install\ Mac\ OS\ X
@Diegus83
Diegus83 / MBpicard.txt
Created November 14, 2020 23:09
Renaming script for MusicBrainz Picard
$if2(%albumartist%,%artist%)/$if(%originalyear%,%originalyear%) - $if($ne(%albumartist%,),%album% $if(%_releasecomment%,\(%_releasecomment%\)) [%label% %catalognumber% %releasecountry%]/,)$if($gt(%totaldiscs%,1),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,%artist% - ,)%title%
1998 - Version 2.0 (special limited edition) [Mushroom Records (UK) Ltd. MUSH29CDX GB]
@Diegus83
Diegus83 / set_mkv_title.sh
Created November 5, 2020 16:22
Set mkv Title tag using the file name, removing the extension
# Usage: set_mkv_tile.sh *.mkv
for f in "$@"
do
if [ ${f: -4} == ".mkv" ]
then
echo "$f"
echo "${f%.*}"
/usr/local/bin/mkvpropedit "$f" --edit info --set title="${f%.*}"
fi
@Diegus83
Diegus83 / extract ssa subtitles.workflow
Last active November 5, 2020 16:20
macOS folder action to extract ssa subtitles from MKV files recursively as srt
# add a Run shell script module in automator, pass input as arguments. Set as a folder action on the appropiate folders.
for f in "$@"
do
if [ ${f: -4} == ".mkv" ]
then
/usr/local/bin/ffmpeg -hide_banner -y -loglevel quiet -i "$f" -map 0:s? "${f%.*}".en.srt
fi
done
@Diegus83
Diegus83 / conver font suicases.txt
Last active October 27, 2020 20:56
Convert font suitcases (resource forks) in modern macOS
First extract the suitcases to regular files with dataforks
-----------------------------------------------------------------
(Source: http://xahlee.info/UnixResource_dir/macosx.html)
(Source: http://fondu.sourceforge.net/)
(Source: https://stackoverflow.com/questions/7412462/using-os-9-resource-fork-fonts-in-css-with-font-face/64561713#64561713)
This is a very old file format where the font information is only contained in the resource fork, not the data fork, so the files seem empty to most modern apps.
First we can group them all in a single directory taking advantage of the find command, because find doesn't see the resource fork and consider the file empty, we create a new directory in the user home and copy all the suitcases there:
@Diegus83
Diegus83 / Record System Audio
Last active January 5, 2021 14:31
How to do Quicktime screen recordings with system audio
brew cask install blackhole
#https://github.com/ExistentialAudio/BlackHole
Record System Audio
Setup Multi-output Device
In Audio Midi Setup->Audio Devices Right-click on the newly created Multi-output and select "Use This Device For Sound Output"
Open digital audio workstation (DAW) such as GarageBand or QuickTime and set input device to "BlackHole"
Set track to input from channel 1-2
Play audio from another application and monitor or record in your DAW.
@Diegus83
Diegus83 / Disable SMBv3 server support in macOS
Last active September 7, 2020 15:08
Disable SMBv3 server support in macOS
Set your macOS server to deny SMB 3 connections
Validate negotiate requests are an SMB 3 feature that clients initiate. To prevent clients from making these requests, you can set your macOS server to accept only SMB 2 connections. A bit-field in server preferences controls Server Dialect. The keyword for this bit-field is ProtocolVersionMap. It uses only three bits:
Value Meaning
1 Support SMB 1
2 Support SMB 2
4 Support SMB 3
To support multiple dialects, combine bits.
@Diegus83
Diegus83 / findPID.py
Created December 10, 2019 14:55
Find which PID a dialog belongs to in macOS
#!/usr/bin/python2.7
#original source: https://superuser.com/questions/902869/how-to-identify-which-process-is-running-which-window-in-mac-os-x
import Quartz
import time
from Foundation import NSSet, NSMutableSet
def transformWindowData(data):
list1 = []
for v in data:
@Diegus83
Diegus83 / sleep.json
Created September 23, 2019 21:05
Karabiner mod to sleep MacBook with external monitor
{
"title": "Diego",
"rules": [
{
"description": "Hold down left control to sleep",
"manipulators": [
{
"from": {
"key_code": "left_control",
"modifiers": {
@Diegus83
Diegus83 / radios.sh
Created September 16, 2019 23:53
Script para escuchar radios argnetinas desde la terminal
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Uso radios.sh nombre_radio"
echo "Requiere VLC (brew install vlc)"
echo "radios.sh --help para ver las radios disponibles"
else
echo "$(cat $0 | grep "#" | grep -m 1 -i $1 | cut -d" " -f2 | vlc -Idummy --quiet -)"
fi