Skip to content

Instantly share code, notes, and snippets.

View oin's full-sized avatar

Jonathan Aceituno oin

  • Seville, Spain and Chagny, France
View GitHub Profile
@oin
oin / flashy.py
Last active February 16, 2024 16:05
A small script to automate flashing to microcontrollers I often use
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import subprocess
import os
from abc import ABC, abstractmethod
def openocd_basecmd_stlink(target):
return [ "openocd", "-f", "interface/stlink.cfg", "-f", f"target/{target}.cfg", "-c", "transport select hla_swd; set WORKAREASIZE 0x20000; reset_config none separate; init; reset init" ]
OPENOCD_ENDCMD = [ "-c", "reset run; shutdown" ]
@oin
oin / Go to heading (Bear).kmmacros
Last active October 31, 2020 13:10
Keyboard Maestro macro that displays a searchable list of headings of the current Bear note on Cmd+R. Caution: Doesn't work when the Marked app is installed, and the macro needs to be adjusted to your system.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>Activate</key>
<string>Normal</string>
<key>CreationDate</key>
<real>625178916.75752902</real>
<key>Macros</key>
@oin
oin / ListEventTaps.m
Created October 11, 2020 13:41
macOS command line program to list currently installed event taps and all their details in YAML format
// Compile using:
// clang -fobjc-arc -framework Cocoa -O2 ListEventTaps.m -o ListEventTaps
#import <Cocoa/Cocoa.h>
#import <CoreGraphics/CoreGraphics.h>
#include <libproc.h>
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
@oin
oin / ActivateAppWithoutWindows.m
Created October 11, 2020 13:39
macOS command line program to activate an application without putting all of its windows in front
// Compile using:
// clang -fobjc-arc -framework Cocoa -O2 ActivateAppWithoutWindows.m -o ActivateAppWithoutWindows
#import <Cocoa/Cocoa.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
if(argc != 2) {
printf("Usage: %s com.app.bundleidentifier\n", argv[0]);
return 1;
@oin
oin / Notebook Fixed.tmTheme
Created February 4, 2018 11:17
Notebook TextMate theme (by Fred LeBlanc) fixed for use with Sublime Text and other editors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>name</key>
<string>Notebook Fixed</string>