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
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 開発ログ

時雨堂 シナリオ負荷試験ツール Oribe 開発ログ

日時

2018-08-05

時雨堂

バージョン

18.08.0

url

https://shiguredo.jp/

depth

3

@osnr
osnr / tap.swift
Created December 22, 2017 21:27
//
// ScreenCapture.swift
// Screenotate
//
// Created by Omar Rizwan on 7/6/17.
// Copyright © 2017 Omar Rizwan. All rights reserved.
//
import Foundation
import Cocoa
<?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">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIdentifier</key>
<string>net.von-gagern.UsbWorkaround</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>

Swift Don'ts

  • Don't add code cruft. Avoid parentheses around conditions in if-statements or with the return keyword. Don't add semicolons except where syntactically demanded in statements or to separate statements on the same line.
  • Don't use ALL_CAPS; use camelCase
  • Don't fight type inference. Use enumeration prefixes, self-references, and class names (with constructors) only when necessary or to clarify coding intent.
  • Don't use var when let is appropriate, especially for properties. The compiler better optimizes let statements for items whose values will not change during their lifetime. For example, Apple writes, "It is good practice to create immutable collections in all cases where the collection does not need to change. Doing so enables the Swift compiler to optimize the performance of the collections you create."
  • Don't use classes when structs will do. Use class