Skip to content

Instantly share code, notes, and snippets.

View pmarkowsky's full-sized avatar
🎅
Keeping Santa Jolly

Pete Markowsky pmarkowsky

🎅
Keeping Santa Jolly
View GitHub Profile

Mermaid on Github Examples

All of these diagrams are dynamically rendered during html display by Github, the images generated from text inside the Github-Flavored Markdown. None are static images. Mermaid support was released for Github on 2022-02-14

Pros & Cons:

  • Pro: You don't need to care about the layout.
  • Con: You cannot control the layout.

Notes:

  • Not all the features of Mermaid (in particular symbols B-->C[fa:fa-ban forbidden], hyperlink and tooltips) are supported by Github.
@pmarkowsky
pmarkowsky / kpc_demo.c
Created May 18, 2023 04:05 — forked from ibireme/kpc_demo.c
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
//
//
// Demo 1 (profile a function in current thread):
// 1. Open directory '/usr/share/kpep/', find your CPU PMC database.
// For M1 (Pro/Max), the database file is '/usr/share/kpep/a14.plist'.
// 2. Select a few events that you are interested in,
// add their names to the `profile_events` array below.
@pmarkowsky
pmarkowsky / simplevm.c
Created May 16, 2023 16:32 — forked from imbushuo/simplevm.c
Demonstrates Hypervisor.Framework usage in Apple Silicon
// simplevm.c: demonstrates Hypervisor.Framework usage in Apple Silicon
// Based on the work by @zhuowei
// @imbushuo - Nov 2020
// To build:
// Prepare the entitlement with BOTH com.apple.security.hypervisor and com.apple.vm.networking WHEN SIP IS OFF
// Prepare the entitlement com.apple.security.hypervisor and NO com.apple.vm.networking WHEN SIP IS ON
// ^ Per @never_released, tested on 11.0.1, idk why
// clang -o simplevm -O2 -framework Hypervisor -mmacosx-version-min=11.0 simplevm.c
// codesign --entitlements simplevm.entitlements --force -s - simplevm
@pmarkowsky
pmarkowsky / lkvh.c
Created March 15, 2023 18:14 — forked from ryanwoodsmall/lkvh.c
get linux kernel version from linux/version.h header and uname() syscall
#include <stdio.h>
#include <linux/version.h>
#include <sys/utsname.h>
/*
* from rhel7's linux/version.h:
* #define LINUX_VERSION_CODE 199168
* #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
*/
@pmarkowsky
pmarkowsky / crackaddr_vuln.c
Created March 15, 2023 13:55 — forked from withzombies/crackaddr_vuln.c
halvar's reimplementation of mark dowd's crackaddr vulnerability
/*
Copyright (c) 2011, Thomas Dullien
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. Redistributions
@pmarkowsky
pmarkowsky / crackaddr_vuln.c
Created March 15, 2023 13:55 — forked from withzombies/crackaddr_vuln.c
halvar's reimplementation of mark dowd's crackaddr vulnerability
/*
Copyright (c) 2011, Thomas Dullien
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. Redistributions
@pmarkowsky
pmarkowsky / wake.cpp
Created December 14, 2021 17:34 — forked from nnethercote/wake.cpp
Program that triggers N wakeups per second
#include <mach/mach_init.h>
#include <mach/task.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
static void