Skip to content

Instantly share code, notes, and snippets.

View Sam0230's full-sized avatar
💭
I may be slow to respond.

Sam0230

💭
I may be slow to respond.
View GitHub Profile
@Sam0230
Sam0230 / utm-arch-linux-installation-guide.md
Last active September 23, 2024 13:47
Installing Arch Linux ARM in a UTM virtual machine

Installing Arch Linux ARM in a UTM virtual machine

Steps:

  1. Create a new virtual machine.
  2. Go to System tab, change architecture to `ARM64 (aarch64)' and increase memory as needed.
  3. Download Alpine Linux LiveCD:
mirror=https://dl-cdn.alpinelinux.org/alpine
curl -o alpine-virt-latest-aarch64.iso "$mirror/latest-stable/releases/aarch64/$(curl "$mirror/latest-stable/releases/aarch64/latest-releases.yaml" | /usr/bin/grep -E 'file: alpine-virt-[0-9\.]+-aarch64\.iso' | head -n 1 | sed 's/ //g' | sed 's/\t//g' | sed 's/^file://')"
  1. Go to Drives tab, New Drive, set size to 20GiB or larger, then Inport Drive, choose the file you just downloaded.
@Sam0230
Sam0230 / screenlockMonitor.swift
Created July 31, 2021 17:35
Monitoring lock / unlock on macOS.
// import Foundation;
import UserNotifications;
let dnc = DistributedNotificationCenter.default();
let lockObserver = dnc.addObserver(forName: .init("com.apple.screenIsLocked"), object: nil, queue: .main) { _ in
print("lock");
exit(0);
};
let unlockObserver = dnc.addObserver(forName: .init("com.apple.screenIsUnlocked"), object: nil, queue: .main) { _ in
print("unlock");
exit(0);
@Sam0230
Sam0230 / touchBar.sh
Last active July 31, 2021 18:31 — forked from JamesMarino/TouchBar
Enable or disable the touch bar.
#!/bin/bash
if [ "$1" == "enable" ]; then
launchctl load /System/Library/LaunchDaemons/com.apple.touchbarserver.plist
/usr/libexec/TouchBarServer &
sleep 0.07
killall TouchBarServer
elif [ "$1" == "disable" ]; then
launchctl unload /System/Library/LaunchDaemons/com.apple.touchbarserver.plist
else
echo -e "Usage:\n sudo $0 enable\n sudo $0 disable"
@Sam0230
Sam0230 / moved.txt
Last active September 21, 2021 20:04
A script to install homebrew with precautions against command spoofing.
Please go to https://github.com/Sam0230/secureHomebrew
@Sam0230
Sam0230 / macos-build-ffmpeg.sh
Last active July 27, 2021 11:55
ffmpeg: allow non-monotonous DTS with alwnmodts fflag
curl -fsSL https://gist.githubusercontent.com/Sam0230/1ba6cf8a8a23cbb6f42d0df0101f8ede/raw/02ef89ae544e1c8fd6ba9bed47f21730df41eb7a/patch.patch | patch -p 1
./configure \
--prefix=/usr/local \
--enable-shared \
--enable-pthreads \
--enable-version3 \
--enable-nonfree \
--cc=clang \
--enable-ffplay \
--enable-gnutls \