Skip to content

Instantly share code, notes, and snippets.

View tonyseek's full-sized avatar

Jiangge Zhang tonyseek

View GitHub Profile
@kconner
kconner / macOS Internals.md
Last active May 10, 2024 17:04
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@bpetlert
bpetlert / usb-net-restart
Created September 25, 2022 07:53
Restart USB 3.0 to ethernet adapter (ASIX Electronics Corp. AX88179 Gigabit Ethernet)
#!/usr/bin/env bash
#
# Restart USB 3.0 to ethernet adapter (ASIX Electronics Corp. AX88179 Gigabit Ethernet)
#
# The device will stop functioning with this error message below:
#
# [ 1179.475926] kernel: xhci_hcd 0000:04:00.0: WARN: TRB error for slot 1 ep 5 on endpoint
# [ 1179.607026] kernel: xhci_hcd 0000:04:00.0: WARN waiting for error on ep to be cleared
# [ 1179.607049] kernel: xhci_hcd 0000:04:00.0: WARN waiting for error on ep to be cleared
@jirihnidek
jirihnidek / flock_example.py
Created June 21, 2021 13:56
File locking using fcntl.flock using Python
"""
Example of using fcntl.flock for locking file. Some code inspired by filelock module.
"""
import os
import fcntl
import time
def acquire(lock_file):
@citruz
citruz / QEMU_ON_M1.md
Last active May 10, 2024 05:49
Create Ubuntu and Windows VMs with QEMU on Apple Silicon

Running Linux and Windows on M1 with QEMU

30.11.2020: Updated with the new patchseries and instructions for Windows

02.12.2020: Added tweaks

08.12.2020: Updated with patchseries v4

31.01.2020: Updated with patchseries v6

@1a57danc3
1a57danc3 / FUCK APPLE OCSP
Last active July 28, 2022 12:46
FUCK APPLE OCSP
127.0.0.1 ocsp-lb.apple.com.akadns.net
127.0.0.1 ocsp-cn-lb.apple.com.akadns.net
127.0.0.1 ocsp.apple.com.download.ks-cdn.com
127.0.0.1 k128-mzstatic.gslb.ksyuncdn.com
127.0.0.1 ocsp.apple.com.cdn20.com
127.0.0.1 ocsp.g.aaplimg.com
127.0.0.1 ocsp.apple.com
127.0.0.1 ocsp.digicert.com
@imbushuo
imbushuo / Vibrator.cs
Last active November 2, 2019 10:57
Turn your Apple Magic Trackpad 2 into a vibrator
using HidSharp;
using System.Linq;
namespace ForceTouchTrigger
{
class Program
{
static void Main(string[] args)
{
// Force Touch Device: USB\VID_05AC&PID_0265&MI_02
@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active May 5, 2024 14:39
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
@pamolloy
pamolloy / README.md
Last active April 6, 2024 05:49
Mesh network using VXLAN over Wireguard
@ushuz
ushuz / fix-country.py
Last active August 5, 2023 05:58
Fix macOS global "Country" setting
# view gloabl prefs in json
# plutil -convert json -o - -- /Library/Preferences/.GlobalPreferences.plist | python -m json.tool
import CoreFoundation as cf
# get current Country
cf.CFPreferencesCopyValue('Country', cf.kCFPreferencesAnyApplication, cf.kCFPreferencesAnyUser, cf.kCFPreferencesAnyHost)
# set Country
cf.CFPreferencesSetValue('Country', 'TW', cf.kCFPreferencesAnyApplication, cf.kCFPreferencesAnyUser, cf.kCFPreferencesAnyHost)
@F21
F21 / signing-gpg-keys.md
Last active May 5, 2024 20:59
Signing someone's GPG key

This is a quick guide of the commands we use to sign someone's GPG key in a virtual key signing party.

Note: The steps cover only the technical aspects of signing someone's key. Before signing someone's key, you must verify their identity. This is usually done by showing government-issued ID and confirming the key's fingerprint

The commands will work for both GPG and GPG2.

I use Julian's key for the examples. His key id is 2AD3FAE3. You should substitute with the appropriate key id when running the commands.

Signing the key

  1. List the keys currently in your keyring: gpg --list-keys.