Skip to content

Instantly share code, notes, and snippets.

View leiless's full-sized avatar
🎯
Focusing

Fishbone° leiless

🎯
Focusing
  • China
  • 20:03 (UTC +08:00)
View GitHub Profile
@leiless
leiless / barebone_quicklook_build.log
Last active January 20, 2019 04:18
Barebone QuickLook plugin build log
Showing All Messages
Build target QuickLookDemo of project QuickLookDemo with configuration Debug
Write auxiliary files
/bin/mkdir -p /Users/lynnl/dev/QuickLookDemo/DerivedData/QuickLookDemo/Build/Intermediates.noindex/QuickLookDemo.build/Debug/QuickLookDemo.build/Objects-normal/x86_64
write-file /Users/lynnl/dev/QuickLookDemo/DerivedData/QuickLookDemo/Build/Intermediates.noindex/QuickLookDemo.build/Debug/QuickLookDemo.build/Objects-normal/x86_64/QuickLookDemo.LinkFileList
write-file /Users/lynnl/dev/QuickLookDemo/DerivedData/QuickLookDemo/Build/Intermediates.noindex/QuickLookDemo.build/Debug/QuickLookDemo.build/QuickLookDemo-all-target-headers.hmap
@leiless
leiless / timestr.c
Last active June 13, 2020 02:32
Format usual time string
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#define TIMESTR_SZ 32
static const char *timestr(void)
{
static char str[TIMESTR_SZ];
struct timeval tv;
@leiless
leiless / stringify_flags.Makefile
Created January 29, 2019 15:35
Stringify Makefile compile flags for ease of debugging
# Stringify compile flags for ease of debugging
CPPFLAGS+= -D__CFLAGS__=\"$(shell sed 's/ /\\ /g' <<< '$(CFLAGS)')\"
CPPFLAGS+= -D__LDFLAGS__=\"$(shell sed 's/ /\\ /g' <<< '$(LDFLAGS)')\"
@leiless
leiless / iokit_kext_build.log
Created February 3, 2019 06:09
Barebone IOKit kernel extension build log(Xcode 9.4.1(9F2000))
Showing All Messages
Build target IOKitExample of project IOKitExample with configuration Debug
Write auxiliary files
write-file /Users/lynnl/dev/IOKitExample/DerivedData/IOKitExample/Build/Intermediates.noindex/IOKitExample.build/Debug/IOKitExample.build/IOKitExample-all-target-headers.hmap
/bin/mkdir -p /Users/lynnl/dev/IOKitExample/DerivedData/IOKitExample/Build/Intermediates.noindex/IOKitExample.build/Debug/IOKitExample.build/DerivedSources
write-file /Users/lynnl/dev/IOKitExample/DerivedData/IOKitExample/Build/Intermediates.noindex/IOKitExample.build/Debug/IOKitExample.build/DerivedSources/IOKitExample_info.c
Anonymous UUID: ACB34763-3BB9-ECBA-9615-D786D1C65C95
Tue Feb 12 20:23:26 2019
*** Panic Report ***
panic(cpu 1 caller 0xffffff801f78776f): Kernel trap at 0xffffff801f746340, type 14=page fault, registers:
CR0: 0x000000008001003b, CR2: 0xffffff8031990000, CR3: 0x000000002256f000, CR4: 0x00000000003606e0
RAX: 0xffffff8031990000, RBX: 0xffffff80b771b99a, RCX: 0x0000000000000000, RDX: 0x0000000000000030
RSP: 0xffffff80b771b860, RBP: 0xffffff80b771b880, RSI: 0xffffff803198f880, RDI: 0xffffff80b771b990
R8: 0xffffff80b771ba90, R9: 0x0000000000000008, R10: 0x000000000000000a, R11: 0x0000000000000000
@leiless
leiless / AXUtility_valueOfUIElement.m
Last active February 22, 2019 13:04
Fetch AXUIElement attribute's value from a given path
/**
* Fetch AXUIElement attribute's value from a given path
* @attributePath Parent-child path string
* Example: "AXMenuBar"
* "AXFocusedWindow, AXDocument"
* "AXFocusedWindow, AXCloseButton, AXEdited"
* @return see [self valueOfUIElement: attribute:]
*
* TRYME: reprototype to [self valueOfUIElement:(AXUIElementRef) attributePath:(NSString *) ...]
*/
@leiless
leiless / AXUtility_valueOfUIElement_VA_ARGS.m
Last active March 26, 2019 12:08
Fetch AXUIElement attribute's value from a given list of attributes
/**
* Fetch AXUIElement attribute's value from a given list of attributes
* @attributes Attribute list
* @return Attribute's value NULL if failed to get
* You should use CFGetTypeID() to inspect type of return value before use it
* If nonnull you must release it by CFRelease()
*
* NOTE: must pass NULL to terminate `attributes' parameter
* otherwise undefined behaviour may happen
*/
/**
* Creates an array of all uniform type identifiers indicated
* by the specified tag under builtin tag classes
* @inTag: the tag string
* @inConformingToUTI the identifier of a type to which the result must conform
* @return a new CFArrayRef containing all type identifiers
* NULL if no inConformingToUTI match or memory failure
* Ownership follows the The Create Rule
*/
CFArrayRef UTTypeCreateBuiltinIdentifiersForTag(
@leiless
leiless / base16_encode.c
Created April 3, 2019 08:47
Encode a buffer into its base16 representation
#include <stdint.h>
#include <stddef.h>
static const uint16_t __base16_enc_le[] = {
0x3030, 0x3130, 0x3230, 0x3330, 0x3430, 0x3530, 0x3630, 0x3730,
0x3830, 0x3930, 0x4130, 0x4230, 0x4330, 0x4430, 0x4530, 0x4630,
0x3031, 0x3131, 0x3231, 0x3331, 0x3431, 0x3531, 0x3631, 0x3731,
0x3831, 0x3931, 0x4131, 0x4231, 0x4331, 0x4431, 0x4531, 0x4631,
0x3032, 0x3132, 0x3232, 0x3332, 0x3432, 0x3532, 0x3632, 0x3732,
0x3832, 0x3932, 0x4132, 0x4232, 0x4332, 0x4432, 0x4532, 0x4632,
@leiless
leiless / parse_long_long.c
Last active August 4, 2019 00:51
[sic strtol(3)] Convert a string value to a long long
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
/**
* [sic strtoll(3)] Convert a string value to a long long
*
* @str the value string
* @delim delimiter character(an invalid one) for a success match
* note '\0' for a strict match