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 / .gitignore
Created June 6, 2019 08:59
Build openconnect
.DS_Store
.dependencies
homebrew
src
usr
@niw
niw / test.py
Last active August 27, 2023 13:26
Use CodeLlama on macOS with MPS quickly
# Usage
# =====
#
# ## Prerequisite
#
# Prepare Python 3, for exmaple, install Homebrew and `brew install python`.
#
# ## Install dependencies
#
# $ python3 -m venv .venv
@niw
niw / download_macos_and_create_install_disk.sh
Last active July 18, 2023 10:44
A script to download macOS install image and create an install disk image
#!/usr/bin/env bash
set -e
VOLUME_PATH=/Volumes/installer
while getopts ":d:h" opts; do
case $opts in
d)
VOLUME_PATH=$OPTARG
;;
@niw
niw / main.swift
Created July 13, 2023 06:29
Simple parser combinator, lexer, paresr and evaluator for double value math for simple logic configuration
import Foundation
extension String: Error {}
// MARK: - Parser Combinator
typealias ParserFunction<Element, Output> =
(any Collection<Element>) throws -> (Output, any Collection<Element>)
protocol Parser<Element, Output> {
@niw
niw / remove_jre.sh
Created May 28, 2013 22:30
Remove risky Java plugin which installed by Oracle JDK package.
#!/bin/sh
# Remove a risky plug-in.
rm -rf "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin"
# Remove symlink provided by the plug-in.
rm -f "/Library/LaunchAgents/com.oracle.java.Java-Updater.plist"
rm -f "/Library/LaunchDaemons/com.oracle.java.Helper-Tool.plist"
rm -f "/Library/PreferencePanes/JavaControlPanel.prefPane"
@niw
niw / main.swift
Created July 12, 2023 04:15
Tiny SExpr Interpretor
import Foundation
extension String: Error {}
// MARK: - Evaluation
enum Atom {
case symbol(String)
case number(Double)
}
@niw
niw / a.m
Created July 7, 2023 09:23
A parser for the visual format string
@import AppKit;
@import Foundation;
#include <stdio.h>
int main(int argc, char *argv[]) {
@try {
if (argc < 2) {
printf("Usage: %s [visual format for a 'view']\n", argv[0]);
return 0;
@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;
@niw
niw / opencalm-7b-peft-lora.ipynb
Created May 21, 2023 03:23
OpenCALM-7B を PEFT を使って LoRA でファインチューンする.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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/>.