Skip to content

Instantly share code, notes, and snippets.

View csarron's full-sized avatar
🎯
Focusing

Qingqing Cao csarron

🎯
Focusing
View GitHub Profile
@ibireme
ibireme / kpc_demo.c
Last active October 26, 2026 09:56
A demo shows how to read Intel or Apple M1 CPU performance counter in macOS.
// =============================================================================
// XNU kperf/kpc demo
// Available for 64-bit Intel/Apple Silicon, macOS/iOS, with root privileges.
// Verified across macOS 10.11 to 27.0.
//
//
// Demo 1 (profile a function in current thread):
// 1. Open directory '/usr/share/kpep/', find your CPU PMC database.
// Use this shell command to get plist file name for the current host:
// printf "cpu_%s_%s_%s.plist\n" $(sysctl -nx hw.cputype hw.cpusubtype hw.cpufamily) | sed -E 's/0x0*//g'
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active October 7, 2026 18:10
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04