Skip to content

Instantly share code, notes, and snippets.

@killgxlin
killgxlin / windows.sh
Created November 23, 2021 07:56 — forked from fasterthanlime/windows.sh
Building ffmpeg & libx264 with MSVC from msys2
#!/bin/bash
set -e
if [[ -z "${FFRUST_VC_PATH}" ]]; then
if [[ -n "${FFRUST_RECURSING}" ]]; then
echo "Something went terribly wrong with our MVSC/msys2 magic"
exit 1
fi
@killgxlin
killgxlin / gist:0a28ca18cca9303ebd6c8187ad23de95
Created January 16, 2020 05:45
osx1015 设置 ScreenCapture 权限
#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;
@killgxlin
killgxlin / main.go
Created August 27, 2019 08:09 — forked from KatelynHaworth/main.go
Example of run an interactive process on the current user from system service on windows (Golang)
package main
import (
"github.com/kardianos/service"
"log"
"flag"
)
type Service struct {}
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));
@killgxlin
killgxlin / libevent_example.c
Last active August 29, 2015 14:06
a libevent example
/*
============================================================================
Name : libevent_sample.c
Author : killerg
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/