Skip to content

Instantly share code, notes, and snippets.

@E8D08F
E8D08F / key2mac.conf
Created October 7, 2025 06:34
Remapping keys in macOS-style using keyd. https://man.archlinux.org/man/extra/keyd/keyd.1.en
[ids]
*
[main]
meta = overload(command, layer(meta))
control = layer(emacs)
leftalt = layer(symbol)
[command:C]
c = C-insert
@E8D08F
E8D08F / tategaki.typ
Last active December 21, 2024 14:13
Naïve implementation of tategaki in Typst
/*
* Created by e8d08f on 21/12/2024, v0.1
*
* This file is licensed under the MIT License.
* Read the end of this file for the full license.
*/
/// TYPOGRAPHY SETTINGS
#let _text = read("./raw.txt").trim() // Target text to typeset
@E8D08F
E8D08F / EffectView.swift
Created February 27, 2023 10:50
The definitive EffectView.
struct EffectView: NSViewRepresentable {
@Binding var window: NSWindow?
let material: NSVisualEffectView.Material
let blendingMode: NSVisualEffectView.BlendingMode
let followsWindowActiveState: Bool
func makeNSView(context: Context) -> NSVisualEffectView {
let view = NSVisualEffectView()
view.material = material
view.blendingMode = blendingMode
import AppKit
import SwiftUI
enum Metrics {
static let titlebarHeight: CGFloat = 28
static let windowLength: CGFloat = 204
static let mainHeight: CGFloat = 135
static var drawerHeight: CGFloat {
import AppKit
class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
var window: NSWindow!
private func setStandardButtons() {
if let titlebar = window.standardWindowButton(.closeButton)?.superview,
let titlebarContainer = titlebar.superview {
let subviews = titlebar.subviews + titlebarContainer.subviews
@E8D08F
E8D08F / lgth_step_down.sass
Created December 14, 2022 16:49
Justified text whose line length is the integral multiple of its font size.
@use "sass:math"
$fs: 21px // Font size
$mplr: 1.667 // Line Multiplier 間距因子
$lcct: 32 // Line character count 列粒
$lgth: $lcct * 1rem // Line length 列長
$lmch: $mplr * 1rem // Line march 列間距
$lsid: calc(($mplr - 1) / 2) * 1rem // Line side
$lacs: (2 * $mplr - 1) * 1rem // Line across
@E8D08F
E8D08F / PcS.bash
Created December 9, 2022 13:25
Generate PcS font subset, using `pyftsubset` and `east-asian-spacing`. Should turn on `chws` or `vchw`.
pcs () {
basename=$1
pyftsubset $1 --unicodes='203c,2047-2049,3001,3002,301d,301f,ff01,ff0c,ff1a,ff1b,ff1f,3008-3011,3014-301B,30FB,ff08,ff09' --layout-features='vert,vrt2'
east-asian-spacing ${basename%.*}.subset.${basename##*.} -o ${basename%.*}.pcs.${basename##*.}
}
@E8D08F
E8D08F / kuma.css
Last active November 12, 2022 06:28
Tategaki for bearblog.dev
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
--foreground-colour: #21272e;
--background-colour: #fdfdfc;
--a-colour: #438fa2;
/* Typography */
--font-size: 18px;
--line-em: 32;
import Cocoa
import SwiftUI
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
var popover: NSPopover!
var statusItem: NSStatusItem!
var menu: NSMenu!
func applicationDidFinishLaunching(_ aNotification: Notification) {