View gist:0a28ca18cca9303ebd6c8187ad23de95
#import <Foundation/Foundation.h> | |
#import <CoreVideo/CoreVideo.h> | |
#import <AppKit/AppKit.h> | |
BOOL canRecordScreen() | |
{ | |
if (@available(macOS 10.15, *)) { | |
CFArrayRef windowList = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID); | |
NSUInteger numberOfWindows = CFArrayGetCount(windowList); | |
NSUInteger numberOfWindowsWithName = 0; |
View main.go
package main | |
import ( | |
"github.com/kardianos/service" | |
"log" | |
"flag" | |
) | |
type Service struct {} |
View example.cpp
int | |
write_json(int wfd, Document &doc) { | |
auto &al = doc.GetAllocator(); | |
GenericStringBuffer<UTF8<>, Document::AllocatorType> sb(&al); | |
PrettyWriter<GenericStringBuffer<UTF8<>, Document::AllocatorType>, UTF8<>, UTF8<>, Document::AllocatorType > sbwr(sb, &al); | |
doc.Accept(sbwr); | |
return strndup(sb.GetString(), sb.GetSize()); | |
uint32_t size = sb.GetSize(); | |
assert(write(wfd, &size, sizeof(size)) == sizeof(size)); |
View libevent_example.c
/* | |
============================================================================ | |
Name : libevent_sample.c | |
Author : killerg | |
Version : | |
Copyright : Your copyright notice | |
Description : Hello World in C, Ansi-style | |
============================================================================ | |
*/ |