Skip to content

Instantly share code, notes, and snippets.

View niw's full-sized avatar
🐱
Meow

Yoshimasa Niwa niw

🐱
Meow
View GitHub Profile
@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 September 3, 2024 17:01
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 December 10, 2024 06:45
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 March 30, 2025 06:00
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
@niw
niw / LICENSE
Last active May 14, 2023 15:35
macOS Big Sur Icon Template for Affinity Photo
macOS Big Sur Icon Template for Affinity Photo (c) by Yoshimasa Niwa
macOS Big Sur Icon Template for Affinity Photo is licensed under a
Creative Commons Attribution 4.0 International License.
You should have received a copy of the license along with this
work. If not, see <http://creativecommons.org/licenses/by/4.0/>.
@niw
niw / swift_corelibs_foundation_windows_build-ja.md
Last active August 28, 2020 09:25
Swift の swift-corelibs-foundation を Windows で手軽にビルドするためのメモ

Swift の swift-corelibs-foundation を Windows で手軽にビルドするためのメモ

ここ に移動しました。