Skip to content

Instantly share code, notes, and snippets.

View markd2's full-sized avatar

Mark Dalrymple markd2

View GitHub Profile
@markd2
markd2 / gist:89447395314b7579ea91b0aed0acb0f4
Created August 3, 2020 20:30
Xcode 100+% idle CPU sample
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/Xcode-11-4-1.app/Contents/MacOS/Xcode
Load Address: 0x104e27000
Identifier: com.apple.dt.Xcode
Version: 11.4.1 (16137)
Build Info: IDEFrameworks-16137000000000000~3
Code Type: X86-64
@markd2
markd2 / Debugging a Custom Instrument
Created May 8, 2020 14:14
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.
Writing a custom instrument.
Have this in code in the app
```
@implementation MJSignpost
+ (os_log_t) log {
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:

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
markd2 / gist:755ec24bfaf22461fadc830685a1ec99
Last active February 24, 2020 19:13
custom keybindings for reviewable.io
[
["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()"],
// 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
#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
markd2 / mute.m
Created December 18, 2018 15:30
Does `copy` really strip off mutability?
#import <Foundation/Foundation.h>
// clang -g -framework Foundation -o mute mute.m
int main(void) {
NSMutableString *blarg = NSMutableString.new;
NSString *copy = blarg.copy;
NSLog(@"%@ | %@", blarg.class, copy.class);
return 0;
@markd2
markd2 / typealias.swift
Created January 22, 2018 18:16
libsyntax typealias creation
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: Trivia.zero, trailingTrivia: .spaces(1))
let intType = SyntaxFactory.makeTypeIdentifier("Int", leadingTrivia: .zero, trailingTrivia: .zero)
let initializer = SyntaxFactory.makeTypeInitializerClause(equal: equal, value: intType)
@markd2
markd2 / activity.m
Last active February 25, 2017 20:46
#import "ViewController.h"
#import <os/activity.h>
#import <os/log.h>
@interface ViewController ()
@end // extension
static os_activity_t g_appActivity;