Skip to content

Instantly share code, notes, and snippets.

View disposedtrolley's full-sized avatar

James Liu disposedtrolley

View GitHub Profile
@disposedtrolley
disposedtrolley / readwise_to_anybox.py
Created July 27, 2024 01:14
Readwise Reader to Anybox converter
#!/usr/bin/env python
import csv
import json
import sys
import os
from datetime import datetime
if __name__ == "__main__":
if len(sys.argv) != 2:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGadkc8wu22gfRNsPqkxdpK/y8mKpvT96TWX5OypV5aj [email protected]
@disposedtrolley
disposedtrolley / kde-snap-launcher.md
Last active November 21, 2020 01:19
Adding Snap binaries to the KDE launcher

When you install a Snap, a .desktop file gets created at /var/lib/snapd/desktop/applications. For example, after running snap install authy, my directory looks like this:

applications ⟩ ls -la                                                                                                            /v/l/s/d/applications
total 8
drwxr-xr-x. 1 root root  66 Nov 20 13:23 ./
drwxr-xr-x. 1 root root  34 Nov 19 14:25 ../
-rwxr-xr-x. 1 root root 377 Nov 19 14:47 authy_authy.desktop*
@disposedtrolley
disposedtrolley / start_work.sh
Last active October 17, 2020 22:39
Tmux script to start work
session="work"
tmux new-session -d -s $session
# Configure window for main project
tmux selectp -t 0
tmux rename-window main
tmux send-keys "cd ~/projects/foo" C-m
# Configure scratch window
@disposedtrolley
disposedtrolley / spi-stm32-zephyr.md
Last active March 1, 2024 16:34
Basic SPI on STM32 with Zephyr

This is a basic guide on setting up SPI for the STM32F401RE Nucleo board on Zephyr. We'll be bootstrapping a new Zephyr project with CMake, getting a binding to a SPI peripheral on the STM32, and writing a Hello, Zephyr string over the wire.

While I'll be using an STM32F401RE, the process should be similar for most STM32 microcontrollers with a SPI peripheral. Also worth noting that this won't be an exhaustive tutorial, nor does it contain best practice! I struggled with this for a whole afternoon, so I'm posting it just in the hopes of getting people on the right track.

@disposedtrolley
disposedtrolley / arm-cross-compiler_macos.md
Created August 27, 2020 10:46
Installing the GNU ARM Embedded Toolchain for macOS

Introduction

The ARM Embedded Toolchain is a GNU licensed cross compiler for ARM CPU architectures, allowing you to compile C/C++ code into binaries which can execute on CPUs such as the Cortex-M line of microcontrollers.

When dealing with C/C++ embedded development, you have the choice of several compilers. Keil is probably the most well-known commercial brand in the embedded toolchain space. They have their own proprietary compiler and IDE which is quite popular for commercial applications (it's pricey and only runs on Windows).

@disposedtrolley
disposedtrolley / .spacemacs
Last active November 6, 2019 04:26
Spacemacs config
;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
;; Bits and pieces from reading The Little Schemer, implemented in Racket.
#lang racket
(define (atom? x)
(and (not (pair? x)) (not (null? x))))
;; Returns whether the supplied s-expression is a list of atoms by
;; recursively checking each element of the input.
(define (lat? l)

Keybase proof

I hereby claim:

  • I am disposedtrolley on github.
  • I am jamesliu (https://keybase.io/jamesliu) on keybase.
  • I have a public key whose fingerprint is 5A53 9C31 4A93 084D A7C1 C560 20EF BE26 9302 A072

To claim this, I am signing this object: