Skip to content

Instantly share code, notes, and snippets.

@dnicolson
dnicolson / iOSKeyboardEscapeKeyEnablerBluetooth.c
Created January 23, 2019 23:47
Support for the corner home button on an iOS keyboard to act as an escape key by analysing Bluetooth packets
// clang -framework Carbon iOSKeyboardEscapeKeyEnablerBluetooth.c -o iOSKeyboardEscapeKeyEnablerBluetooth
// sudo ./iOSKeyboardEscapeKeyEnablerBluetooth
#include <stdio.h>
#include <stdlib.h>
#include <Carbon/Carbon.h>
void TriggerEscKey()
{
CGEventRef event;
@dnicolson
dnicolson / dropbox-git.sh
Created November 4, 2018 16:35
Clone a bare git repo from Dropbox
curl -L https://www.dropbox.com/sh/xxx/yyy > project.git.zip
mkdir project.git
unzip project.git.zip -d project.git
git clone project.git
rm project.git.zip
rm -rf project.git
@klausondrag
klausondrag / README.md
Last active May 9, 2020 23:52
Pinyin support for Language Learning with Netflix Extension
@dnicolson
dnicolson / MediaRemoteEvents.m
Created December 24, 2019 18:16
Use the MediaRemote private framework to get and set the playing state of the Touch Bar based on media change events
// clang -x objective-c -framework Foundation -framework MediaRemote -F /System/Library/PrivateFrameworks TouchBarMediaKeys.m -o TouchBarMediaKeys
// ./TouchBarMediaKeys
#import <Foundation/Foundation.h>
#import <MediaPlayer/MediaPlayer.h>
enum {
kMRPlaybackStateUnknown = 0,
kMRPlaybackStatePlaying,
kMRPlaybackStatePaused,
# Homebrew has done away with options in all of their core formulas
# discussion on this change here: https://github.com/Homebrew/homebrew-core/issues/31510
# Instead, Use the last version of the homebrew forumla that still supported them.
# the formula is here: https://raw.githubusercontent.com/Homebrew/homebrew-core/90e6931235a333899bd2572353ca065bd5535452/Formula/ffmpeg.rb
# install it like this:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/90e6931235a333899bd2572353ca065bd5535452/Formula/ffmpeg.rb \
--with-aom \
--with-chromaprint \
@torque
torque / instructions.md
Last active December 6, 2020 01:32
mpv url-overlay example.

Instructions

  1. clone this gist: git clone https://gist.github.com/5af90be72b98bce36a3e.git mpv-url-overlay-example
  2. copy (or symlink) url-overlay.lua to your mpv scripts directory (~/.config/mpv/scripts or ~/.mpv/scripts)
  3. mpv --no-osc url-overlay-example.mkv
  4. Hold tab to highlight all on-screen urls. If you already use tab for something, bind some key to the command mp_url_overlay_show.
  5. Click urls to launch them. On Linux xdg-open is required. Will not work if you have MOUSE_BTN0 bound to another command.
@frafra
frafra / mbox2html.py
Last active February 17, 2021 16:34
Mailbox to HTML conversion using Python 3 + Jinja2 in less than 100 lines (including GPLv3 license)
#!/usr/bin/env python3
#
# Copyright (C) 2016 - Francesco Frassinelli
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@ClearlyKyle
ClearlyKyle / STR_to_Sentences.py
Created October 8, 2020 21:11
Using pysrt to convert a SRT file to a list of sentences.
import pysrt
import os
output_folder_name = "txt"
try:
os.mkdir("./{}".format(output_folder_name))
except OSError:
pass # already exists
@dnicolson
dnicolson / mkdir.asm
Created November 27, 2015 11:14
An example of making a syscall in assembly on OS X
; nasm -f macho64 mkdir.asm && ld -o mkdir mkdir.o && ./mkdir
%define SYSCALL_MKDIR 0x2000088
%define SYSCALL_EXIT 0x2000001
global start
section .text
start:
call mkdir
@varenc
varenc / Quickly look up a URL in the Wayback Machine in Chrome
Last active May 27, 2021 01:26
Chrome Wayback Machine search engine/bookmarklet. Accepts full URLs and works on Chrome's New Page window.
data:text/html,<script>location.href='https://web.archive.org/web/*/%s'</script>