This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ~/Library/KeyBindings/DefaultKeyBinding.dict */ | |
{ | |
/* | |
* Keybindings for emacs emulation. | |
* | |
* WARNING! After Mountain Lion, this file cannot be symbolic linked to another file, | |
* you need to put this file in ~/Library/KeyBindings/DefaultKeyBinding.dict directly | |
* | |
* Reference: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ScreenCapture.swift | |
// Screenotate | |
// | |
// Created by Omar Rizwan on 7/6/17. | |
// Copyright © 2017 Omar Rizwan. All rights reserved. | |
// | |
import Foundation | |
import Cocoa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// should work with tcc 0.9.27 from: https://bellard.org/tcc/ which I | |
// think merges minimal Darwin support from https://github.com/andreiw/tinycc | |
// (I think only `-run` works; it can't output a Mach-O executable?) | |
// | |
// but the header and libc situation on macOS for non-GCC/clang is | |
// such an incredible mess -- I did kinda get it working, but it's | |
// more fun to just write something that calls directly into the OS & | |
// has no dependencies (: | |
// | |
// $ tcc -nostdlib -nostdinc -run minimal-osx-tcc-hello.c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" | |
tell process "Firefox Nightly" | |
set tmp to value of attribute "AXEnhancedUserInterface" | |
set value of attribute "AXEnhancedUserInterface" to true | |
set returnUrl to value of attribute "AXValue" of text field 1 of combo box 1 of toolbar "Navigation" of UI element 1 of front window | |
set value of attribute "AXEnhancedUserInterface" to tmp | |
return returnUrl | |
end tell | |
end tell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <sys/mman.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
const char TEXTSENTINEL[] = "__TEXTSENTINEL"; | |
size_t assemble(const char* asmsrc, uint8_t* execbuf, size_t execbuflen) { | |
char asmpath[] = "/tmp/asm-XXXXXX"; mkstemp(asmpath); { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require 'ffi' | |
ffi.cdef[[ | |
typedef struct _XDisplay Display; | |
typedef struct Screen Screen; | |
extern Display *XOpenDisplay( | |
const char* /* display_name */ | |
); | |
extern int XDefaultScreen( | |
Display* /* display */ | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require 'ffi' | |
ffi.cdef[[ | |
typedef struct _XDisplay Display; | |
typedef struct Screen Screen; | |
extern Display *XOpenDisplay( | |
const char* /* display_name */ | |
); | |
extern int XDefaultScreen( | |
Display* /* display */ | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- based on https://www.reddit.com/r/gamedev/comments/jumvi5/dualsense_haptics_leds_and_more_hid_output_report/gcemle4/ | |
-- requires hidapi + run with LuaJIT | |
local ffi = require('ffi') | |
ffi.cdef[[ | |
typedef struct hid_device_ hid_device; /**< opaque hidapi structure */ | |
int hid_init(void); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- run with LuaJIT on macOS | |
-- based on excellent answer here: https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process/1911863 | |
local ffi = require('ffi') | |
ffi.cdef[[ | |
typedef unsigned int __darwin_natural_t; | |
typedef __darwin_natural_t natural_t; | |
typedef int integer_t; | |
typedef __darwin_natural_t __darwin_mach_port_name_t; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
</head> | |
<body> | |
<style> | |
style { display: block; white-space: pre; font-family: monospace; } | |
div { background: blue; overflow: hidden; resize: horizontal; } | |
div::before { content: attr(style); } |