Skip to content

Instantly share code, notes, and snippets.

View casouri's full-sized avatar
💭
I may be slow to respond.

Yuan Fu casouri

💭
I may be slow to respond.
View GitHub Profile
@casouri
casouri / greek-text-substitution.plist
Last active January 3, 2025 11:37
Greek text substitution for mac user dictionary.
<?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>phrase</key>
<string>Α</string>
<key>shortcut</key>
<string>alpha</string>
</dict>
@casouri
casouri / eglot-rust-analyzer.el
Last active December 28, 2024 16:19
Configuring eglot for rust-analyzer
;; How to translate LSP configuration examples into Eglot’s format:
;;
;; Usually LSP servers will say something like
;;
;; rust-analyzer.procMacro.attributes.enable (default: true)
;;
;; Translate that into a JSON LSP configuration, you get
;;
;; {
;; "rust-analyzer": {
@casouri
casouri / init.lua
Created April 7, 2018 02:18
sequential key bindings in hammerspoon
-- key to break out of every layer and back to normal
escapeKey = {keyNone, 'escape'}
-- max length of helper measured in character
recursiveBindHelperMaxLineLengthInChar = 80
-- format of helper, the helper is just a hs.alert
recursiveBindHelperFormat = {atScreenEdge=2,
strokeColor={ white = 0, alpha = 2 },
textFont='SF Mono'}
Cost: (besides storage cost)
8 KB/object for metadata in s3, bill at s3 price
32 KB/object for index in glacier, billed at glacier price
Early deletion/overwrite fee: Delete or overwrite before stored for 90
days (glacier) or 180 days (deep glacier).
Transition cost/object:
(defun scroll-up-benchmark ()
(interactive)
(let ((oldgc gcs-done)
(oldtime (float-time))
(count 0))
(condition-case nil (while t (scroll-up) (redisplay) (cl-incf count))
(error (message "GCs: %d Elapsed time: %f seconds Second/scroll: %f"
(- gcs-done oldgc) (- (float-time) oldtime)
(/ (- (float-time) oldtime) count))))))
#include <string.h>
#include <stdio.h>
#include <tree_sitter/api.h>
#include <stdlib.h>
TSLanguage *tree_sitter_c();
struct buffer {
char *buf;
long len;
root@gnu ~# fdisk /dev/nvme0n1
Welcome to fdisk (util-linux 2.35.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/nvme0n1: 232.91 GiB, 250059350016 bytes, 488397168 sectors
Disk model: Samsung SSD 960 EVO 250GB
(use-modules (gnu)
(gnu system nss)
(gnu packages gnome)
(gnu packages version-control)
(gnu packages emacs))
(use-service-modules desktop xorg)
(use-package-modules certs)
(operating-system
(host-name "Blanche")
Process: TeXmacs [42808]
Path: /Applications/TeXmacs.app/Contents/MacOS/TeXmacs
Identifier: org.texmacs.TeXmacs
Version: 2.1 (2.1)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: TeXmacs [42808]
User ID: 501
Date/Time: 2021-09-26 00:35:13.177 -0700
(kbd-map
(:profile emacs)
("emacs:meta c" (kbd-copy))
("emacs:meta v" (kbd-paste))
("emacs:meta s" (save-buffer))
("emacs:meta u" (revert-buffer))
("emacs:meta :" (interactive footer-eval))
("emacs:meta f" (traverse-right))
("emacs:meta b" (traverse-left))