Skip to content

Instantly share code, notes, and snippets.

View niw's full-sized avatar
🐱
Meow

Yoshimasa Niwa niw

🐱
Meow
  • San Francisco, CA
  • X @niw
View GitHub Profile
@niw
niw / Gateron_Low_Profile_Socket.kicad_mod
Last active January 11, 2024 00:26
KiCad footprint for Gateron Low Profile socket
(footprint "Gateron_Low_Profile_Socket" (version 20211014) (generator pcbnew)
(layer "F.Cu")
(tedit 5E123764)
(descr "Hot Swap Socket for Gateron Low Profile Switch")
(attr smd)
(fp_text reference "REF**" (at 0 9.5) (layer "B.SilkS")
(effects (font (size 1 1) (thickness 0.15)) (justify mirror))
(tstamp 1b4a9a9f-50fb-40ce-9b05-77578a9b9c54)
)
(fp_text value "Gateron_Low_Profile_Socket" (at 0 8.5) (layer "F.Fab")
@niw
niw / Gateron_Low_Profile_Socket.usdz
Last active July 29, 2022 07:14
A gist for testing USDZ files.
@niw
niw / a.swift
Last active June 23, 2022 05:54
Wrapped property’s `didSet` is not really useful
import Foundation
@propertyWrapper
struct Wrapper<T> {
class Box<T> {
var value: T
init(_ initial: T) {
value = initial
}
@niw
niw / xps2pdf
Created January 13, 2022 08:38
#!/usr/bin/env bash
# Download ghostpdl source code from <https://github.com/ArtifexSoftware/ghostpdl-downloads/releases>,
# expand an archive, and configure then make.
# Following `BIN_PATH` may need to change for the given version and path.
set -euo pipefail
readonly CURRENT_PATH=$(cd "$(dirname "$BASH_SOURCE[0]")" >/dev/null; pwd)
readonly BIN_PATH=$CURRENT_PATH/ghostpdl-9.55.0/bin
@niw
niw / minecraft_nativeupdater_patcher.sh
Last active January 15, 2022 03:35
A simple patch script to workaround Minecraft nativeUpdater crash on macOS Monterey
#!/usr/bin/env bash
set -euo pipefail
readonly MINECRAFT_APP_PATH=/Applications/Minecraft.app
if [[ ! -d $MINECRAFT_APP_PATH ]]; then
echo "$MINECRAFT_APP_PATH is not found." >&2
exit 1
fi
Thread 7 Crashed:
0 ??? 0x7ff89214e940 ???
1 libsystem_kernel.dylib 0x7ff801c93112 __pthread_kill + 10
2 libsystem_c.dylib 0x7ff801c15d10 abort + 123
3 libsystem_c.dylib 0x7ff801c150be __assert_rtn + 314
4 AppKit 0x7ff805195628 -[_NSAsynchronousPreparation preparedResult] + 1153
5 AppKit 0x7ff804cc9808 -[NSImageView _shownImage] + 787
6 AppKit 0x7ff8047e0e37 -[NSImageView alignmentRectInsets] + 72
7 AppKit 0x7ff8047596e6 -[NSView alignmentRectForFrame:] + 47
8 AppKit 0x7ff8048bf719 -[NSView _recursiveGatherAllKeyViewCandidatesInArray:] + 455
@niw
niw / hvf.patch
Last active June 6, 2023 01:57
Lazy patch to boot Windows 10 ARM on M1 Mac on current QEMU master (5f99210)
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index bff3e0cde7..a0ce7b2dfc 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -1211,7 +1211,6 @@ int hvf_vcpu_exec(CPUState *cpu)
break;
case EC_AA64_SMC:
cpu_synchronize_state(cpu);
- if (arm_cpu->psci_conduit == QEMU_PSCI_CONDUIT_SMC) {
advance_pc = true;
import Foundation
func th() {
print(Thread.current)
}
th()
func a(_ i: Int) async -> Int {
th()
print("sleep \(i)")
@niw
niw / QEMU_EFI-8c552e8-edk2-stable202008-without-xhci.tar.gz
Last active February 22, 2024 17:44
Prebuild version of QEMU_EFI.fd
This file has been truncated, but you can view the full file.
@niw
niw / README.en.md
Last active February 13, 2024 04:24
How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac. Enjoy!

NOTE: that this is current, 10/1/2021 state.

Running Windows 10 on ARM

  1. Install Xcode from App Store or install Command Line Tools on your Mac