Skip to content

Instantly share code, notes, and snippets.


Mark Dalrymple markd2

View GitHub Profile
View gist:89447395314b7579ea91b0aed0acb0f4
Sampling process 89846 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Xcode (pid 89846) every 1 millisecond
Process: Xcode [89846]
Path: /Applications/
Load Address: 0x104e27000
Version: 11.4.1 (16137)
Build Info: IDEFrameworks-16137000000000000~3
Code Type: X86-64
markd2 / Debugging a Custom Instrument
Created May 8, 2020
Trying to create a custom instruments (without CLIPS right now), and I think I have the patterns hooked up correctly, but no data is appearing.
View Debugging a Custom Instrument
Writing a custom instrument.
Have this in code in the app
@implementation MJSignpost
+ (os_log_t) log {
View gist:2be0c3932245e884a4f17de6f5777f64
Hi! Thanks for looking
TL;DR - trying to do anything with os_signpost, but nothing is appearing in instruments.
UPDATE: on devices it's working. Is it supposed to work in the simulator? Points of Interest are on built-in templates, I figured it should work on the device...
The app is all objc, using the C API. See at the end for a swift attempt
More details:
Creating the log like this:
View gist:474705fb8de32618b452a7bdbd60b35c

Since they are calling on Respiratory therapist to help fight the Corona virus, and I am a retired one, too old to work in a hospital setting. I'm gonna share some common sense wisdom with those that have the virus and trying to stay home. If my advice is followed as given you will improve your chances of not ending up in the hospital on a ventilator. This applies to the otherwise generally healthy population, so use discretion.

  1. Only high temperatures kill a virus, so let your fever run high. Tylenol, Advil. Motrin, Ibuprofen etc. will bring your fever down allowing the virus to live longer. They are saying that ibuprophen, advil etc will actually exacerbate the virus. Use common sense and don't let fever go over 103 or 104 if you got the guts. If it gets higher than that take your tylenol, not ibuprophen or advil to keep it regulated. It helps to keep house warm and cover up with blankets so body does not have to work so hard to generate the heat. It usually takes about 3 days of this to break the fever
markd2 / gist:755ec24bfaf22461fadc830685a1ec99
Last active Feb 24, 2020
custom keybindings for
View gist:755ec24bfaf22461fadc830685a1ec99
["f", "Show next/latest diffs", "setProposedDiffBounds()"],
["n", "Next unreviewed file", "nextUnreviewedFile()"],
["p", "Previous unreviewed file", "prevUnreviewedFile()"],
[null, "Next personally unreviewed file", "nextPersonallyUnreviewedFile()"],
[null, "Previous personally unreviewed file", "prevPersonallyUnreviewedFile()"],
["shift+n", "Next changed file", "nextChangedFile()"],
["shift+p", "Previous changed file", "prevChangedFile()"],
[null, "Next visible file", "nextVisibleFile()"],
View vararg.m
// vararg.m -- use varargs to sum a list of numbers
// clang -g -Wall -o vararg vararg.m
#import <stdio.h>
#import <stdarg.h>
// sum all the integers passed in. Stopping if it's zero
View malloc.c
#import <stdio.h>
#import <stdlib.h>
// clang -g -Wall -o malloc malloc.c
int main(void) {
int *blah = malloc(sizeof(int));
printf("blah on alloc: %x\n", *blah);
*blah = 23;
markd2 / mute.m
Created Dec 18, 2018
Does `copy` really strip off mutability?
View mute.m
#import <Foundation/Foundation.h>
// clang -g -framework Foundation -o mute mute.m
int main(void) {
NSMutableString *blarg =;
NSString *copy = blarg.copy;
NSLog(@"%@ | %@", blarg.class, copy.class);
return 0;
markd2 / typealias.swift
Created Jan 22, 2018
libsyntax typealias creation
View typealias.swift
import SwiftSyntax
@greeble(bork) typealias Element = Int
let typeAliasKeyword = SyntaxFactory.makeTypealiasKeyword(leadingTrivia: .spaces(1),
trailingTrivia: .spaces(1))
let elementID = SyntaxFactory.makeIdentifier("Element", leadingTrivia: .zero, trailingTrivia: .spaces(1))
let equal = SyntaxFactory.makeEqualToken(leadingTrivia:, trailingTrivia: .spaces(1))
let intType = SyntaxFactory.makeTypeIdentifier("Int", leadingTrivia: .zero, trailingTrivia: .zero)
let initializer = SyntaxFactory.makeTypeInitializerClause(equal: equal, value: intType)
View activity.m
#import "ViewController.h"
#import <os/activity.h>
#import <os/log.h>
@interface ViewController ()
@end // extension
static os_activity_t g_appActivity;