Skip to content

Instantly share code, notes, and snippets.

View yamaya's full-sized avatar

Masayuki Yamaya yamaya

  • Sapporo, Hokkaido, Japan
View GitHub Profile
@smiled0g
smiled0g / run_llama.sh
Last active June 21, 2023 00:45
Easy way to run local LLM for your M-series Macbooks
#!/usr/bin/env bash
# Install Git Large File Storage (LFS)
brew install git-lfs
git lfs install
# Download & Install Llama
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
LLAMA_METAL=1 make -j # build with Metal support for (M-series) Apple Silicon
@T1T4N
T1T4N / generate-xcode-compilation-database.md
Last active June 3, 2025 13:54
Generate a JSON Compilation Database from an Xcode project

Introduction

A JSON compilation database is a very handy output format which is parsed and used by many development tools. Unfortunately for us Apple Developers, it is not straightforward to generate one from within Xcode, as it is (probably) not Apple's priority and therefore there is no toggle/switch/setting that can be easily enabled to get this information.

There is however a solution, thanks to Apple using Clang/LLVM as their main toolchain.

Implementation

The standard way to generate this with clang would be to use the -MJ flag and give it a file name that typically corresponds to the input file. Using this flag indirectly through Xcode is hard, given that we're not aware of all the other arguments when a compiler call is executed.

However, there is a second hidden/badly documented LLVM flag: -gen-cdb-fragment-path - it is implemented in terms of -MJ and has the same functionality, but it's argument in contrast is an output directory.

@xdlg
xdlg / keymap.c
Last active September 15, 2024 18:47
Better Super Alt+Tab for QMK
// Adds the ALT_TAB keycode to a QMK keymap.
// Based on https://www.reddit.com/r/MechanicalKeyboards/comments/mrnxrj/better_super_alttab/
// Functionality is the following (basically the same thing as a normal Alt + Tab but without having
// to leave Alt pressed):
// - On pressing ALT_TAB, the window switch menu pops up.
// - While the menu is visible, it's possible to cycle through the selection by pressing ALT_TAB
// again, or Shift + ALT_TAB, or the arrow keys.
// - The selected window can be brought up by pressing Enter, which also closes the menu.
@aashreys
aashreys / config.h
Last active September 22, 2024 03:37
Adding RGB Timeout functionality to your QMK keyboard
/* In your config.h define a new variable RGBLIGHT_TIMEOUT and give it a value in milliseconds */
#define RGBLIGHT_SLEEP // allows us to use rgblight_suspend() and rgblight_wakeup() in keymap.c
#define RGBLIGHT_TIMEOUT 30000 // 30 seconds
Fonts included with macOS Catalina
macOS Catalina comes with many built-in or downloadable typefaces.
The following fonts are installed and enabled automatically by macOS Catalina. Additional fonts are available for download or as needed by your document or app. New or updated fonts may be added over time. This list is current as of 24 April 2020.
Al Bayan Bold 13.0d1e6
Al Bayan Plain 13.0d1e6
Al Nile 13.0d2e2
@alexkaessner
alexkaessner / custom-ios-simulator-statusbar.sh
Last active April 8, 2024 18:36
Customize iOS Simulator Status Bar (Xcode 11+)
$ xcrun simctl status_bar booted override --time "9:41" --batteryState charged --batteryLevel 100 --cellularMode active
@bpyamasinn
bpyamasinn / AppDelegate.swift
Last active September 21, 2019 10:07
Mac のキーボードを有効 / 無効を切り替える実装
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
let keyEvent = Event()
lazy var statusItem: NSStatusItem = {
return NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
}()
func applicationDidFinishLaunching(_ aNotification: Notification) {
@yossan
yossan / making_glyph_with_ctfont.swift
Last active September 28, 2021 06:43
Making CGlyph of an extended grapheme cluster.
// CTFontGetGlyphsForCharacters(_:_:_:_:)
// [UniChar] → [CGGlyph]
import Foundation
func makeUnichars(from str: NSString) -> [UInt16] {
let range = NSRange(location:0, length: str.length)
let encoding = String.Encoding.utf16.rawValue
let maxLength = str.maximumLengthOfBytes(using: encoding)
@jhorology
jhorology / my atom66 setting.pro
Created May 11, 2018 11:41
HHKB style layout for NiZ Atom 66
<?xml version="1.0" encoding="UTF-8"?>
<66EC(XRGB)Ble>
<PredefinedCombo>
<List SizeOfView="6" ViewStartAt="0" CursorPos="0" Cycles="1" IsAutoInterval="0" Delay="30" PlayMode="0"/>
</PredefinedCombo>
<PredefinedMacro>
<List SizeOfView="9" ViewStartAt="0" CursorPos="0" Cycles="1" IsAutoInterval="0" Delay="30" PlayMode="0"/>
</PredefinedMacro>
<PredefinedEmu>
<List SizeOfView="9" ViewStartAt="0" CursorPos="0" Cycles="1" IsAutoInterval="0" Delay="30" PlayMode="0"/>
@voluntas
voluntas / shiguredo_loadtest_tool_oribe_log.rst
Last active April 3, 2023 02:59
時雨堂 シナリオ負荷試験ツール Oribe 開発ログ