Skip to content

Instantly share code, notes, and snippets.

@xarbit
xarbit / recovery.sh
Created January 13, 2019 07:29 — forked from jonathantneal/recovery.sh
Create or update macOS Mojave Recovery Partition Without Reinstalling
#!/bin/sh
# Set the macOS installer path as a variable
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
MOUNT_POINT="$MACOS_INSTALLER/Contents/SharedSupport"
echo "macOS installer is \"$MACOS_INSTALLER\""
# Set the target disk as a variable
TARGET=$(diskutil info "$(bless --info --getBoot)" | awk -F':' '/Volume Name/ { print $2 }' | sed -e 's/^[[:space:]]*//')
echo "Target disk is \"$TARGET\""
@xarbit
xarbit / etc.fstab
Created February 3, 2019 09:08 — forked from vadviktor/etc.fstab
Ubuntu guest VMware shared folders using open-vm-tools package and vmhgfs-fuse
.host:/vmshared /mnt/vmshared fuse.vmhgfs-fuse allow_other,uid=1000,gid=1000,auto_unmount,defaults 0 0
@xarbit
xarbit / fritz_tv.m3u
Created March 29, 2019 20:28
fritzbox dvbc to ip
#EXTM3U
#EXTINF:-1 tvg-name="Das Erste HD" tvg-id="ARD.de" group-title="FritzTV" tvg-logo="http://tv.avm.de/tvapp/logos/daserstehd.png",Das Erste HD
rtsp://192.168.10.1:554/?avm=1&freq=330&bw=8&msys=dvbc&mtype=256qam&sr=6900&specinv=1&pids=0,16,17,18,20,5100,5101,1170,1176,2171,2172,5102,5103,5104,5105
#EXTINF:-1 tvg-name="ZDF HD" tvg-id="ZDF.de" group-title="FritzTV" tvg-logo="http://tv.avm.de/tvapp/logos/zdfhd.png",ZDF HD
rtsp://192.168.10.1:554/?avm=1&freq=450&bw=8&msys=dvbc&mtype=256qam&sr=6900&specinv=1&pids=0,16,17,18,20,6100,6110,6120,6121,6123,6130,6131,6170
#EXTINF:-1 tvg-name="RTL" tvg-id="RTL.de" group-title="FritzTV" tvg-logo="http://tv.avm.de/tvapp/logos/rtl.png",RTL
rtsp://192.168.10.1:554/?avm=1&freq=122&bw=8&msys=dvbc&mtype=64qam&sr=6900&specinv=1&pids=0,16,17,18,20,101,1401,1400,1402,1403,1404,1406,1407,1408
#EXTINF:-1 tvg-name="SAT.1" tvg-id="Sat1.de" group-title="FritzTV" tvg-logo="http://tv.avm.de/tvapp/logos/sat1.png",SAT.1
rtsp://192.168.10.1:554/?avm=1&freq=122&bw=8&msys=dvbc&mtype=64qa
@xarbit
xarbit / m3u.swift
Created March 30, 2019 09:17 — forked from Cosmo/m3u.swift
Swift M3U Parser
struct MediaItem {
var duration: Int?
var title: String?
var urlString: String?
static func parseM3U(contentsOfFile: String) -> [MediaItem]? {
var mediaItems = [MediaItem]()
contentsOfFile.enumerateLines({ line, stop in
if line.hasPrefix("#EXTINF:") {
let infoLine = line.stringByReplacingOccurrencesOfString("#EXTINF:", withString: "")
@xarbit
xarbit / brt.m
Created July 4, 2021 11:48 — forked from tao-j/brt.m
M1 External Monitor Brightness Control over DDC
@import Darwin;
@import Foundation;
@import IOKit;
// clang -fmodules -o brt brt.m && ./brt
// credit to @zhuowei for discovering the following APIs
typedef CFTypeRef IOAVServiceRef;
extern IOAVServiceRef IOAVServiceCreate(CFAllocatorRef allocator);
extern IOReturn IOAVServiceCopyEDID(IOAVServiceRef service, CFDataRef* x2);
@import Darwin;
@import Foundation;
@import IOKit;
// clang -fmodules -o i2cwrite i2cwrite.m && ./i2cwrite
typedef CFTypeRef IOAVServiceRef;
extern IOAVServiceRef IOAVServiceCreate(CFAllocatorRef allocator);
extern IOReturn IOAVServiceCopyEDID(IOAVServiceRef service, CFDataRef* x2);
// outputBufferSize must be less than (1 << 12) (4096 bytes)
@xarbit
xarbit / chbrt.m
Created July 4, 2021 11:51 — forked from waydabber/chbrt.m
This should change the brightness level of a single external display connected to an M1 MBP or MBA relative to the current setting using DDC/CI. Reportedly does not work on M1 Mini.
@import Darwin;
@import Foundation;
@import IOKit;
/*******
This should change the brightness level of a single external display connected to an M1 MBP or MBA relative to the current setting using DDC/CI. Reportedly does not work on M1 Mini.
Credits to @tao-j and @alin23
Compile: