Skip to content

Instantly share code, notes, and snippets.

View xrq-phys's full-sized avatar
🚰
Even when working remote, don't forget to drink water!

RuQing Xu xrq-phys

🚰
Even when working remote, don't forget to drink water!
View GitHub Profile
@xrq-phys
xrq-phys / INSTALL.md
Last active August 6, 2024 07:58 — forked from takeit/INSTALL.md
macFUSE + NTFS-3G still supported on macOS 14.5 + M-series chip!

This guide is intended to provide a OSS-based solution for enabling NTFS read+write access on modern macOS. In the meantime, I see some commercial and semi-commercial solutions for NTFS on mac. Some of them are excellent, others might have a debatable reputation. Discretion is stronly adviced there.

本说明旨在介绍一个在现代macOS平台(包括M1/M2等新架构和Intel老架构mac电脑)上可用的NTFS读写模式的挂载方案。 该方案拷贝自 takeit/INSTALL.md,当时在macOS Sierra上可用使用但作者述说需要关闭SIP。本文经测试该方案实有不影响SIP的用法。

NTFS for macOS的商业或半商业的解决方案较为鱼龙混杂,亦存在部分组织误导用户认为「只有少数解决方案能支持最新系统架构」。实际上,macFUSE至今仍被维护,ntfs-3g也仍然可用(编译很快)。希望大家仔细甄别。

1. Install macFUSE:

@xrq-phys
xrq-phys / softplus.hh
Created April 27, 2022 09:31
Complex-valued Softplus in C++. Useful when summing two VERY LARGE numbers.
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <complex>
#include <algorithm>
// Real softplus.
@xrq-phys
xrq-phys / MLComputeGEMM.swift
Created December 25, 2020 18:14
Very simple example of an ML Compute matrix multiplication. Naming convention somehow violated.
import Foundation
import MLCompute
import PlaygroundSupport
let iPage = PlaygroundPage.current
iPage.needsIndefiniteExecution = true
/*
* Apple says MLCMatMulLayer does a ``batch matrix multiplication''
* but didn't make clear its meaning.
@xrq-phys
xrq-phys / A-Guide-to-Build-NumPy-on-Apple-Silicon.md
Last active December 11, 2020 22:17
Compile NumPy on M1 Chip, with Code Attached.

What

Compile NumPy on Apple Silicon M1 Chip

How

  • Create virtual env at, say export VENV=$HOME/.local:
python3 -m venv $VENV
. $VENV/bin/activate
@xrq-phys
xrq-phys / batch_define.jl
Last active September 25, 2020 16:50
Example of batch defining Julia functions. Will be used in BLIS.jl
module BatchDef
macro def_numed_fun(funname, num)
numed_funname = Symbol(string(funname, num))
@show numed_funname
return quote
$(esc(numed_funname))() = $num
end
end
@xrq-phys
xrq-phys / contract_fwd_prototype.jl
Last active July 25, 2020 15:08
Prototype for TBLIS contract for ForwardDiff.jl
# here idx has 3 entries corresponding to e.g. "ik,jk->ij".
contract!(A::Array{T},
B::Array{T},
C::Array{T},
idx) where {T<:Dual} = contract!(T, sizeof(T)/sizeof(tovalue(T)), # tovalue unveils base type.
A, 0, B, 0, C, 0, idx)
contract!(Type::Dual{Tg, T, ND}, topst, # top-level stride
A::Array, sftA, # arrays here are all at their top-level (not dispatched)
B::Array, sftB,
@xrq-phys
xrq-phys / Code_OSS_Aarcha64.md
Last active December 26, 2020 07:57
[DEPRECATED: Official Available] Installing Native Aarch64 VSCode on Windows on Arm Devices
@xrq-phys
xrq-phys / example_bli_ker_call.cc
Last active March 18, 2020 13:18
Trying to make a simple example of calling BLIS kernel (direct call to GEMM kernel). Maybe useful if we're to play with special matrices not available in BLAS.
#include <iostream>
#include <blis/blis.h>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main(const int argc, const char *argv[])
{
// these two doesn't conflict.
using namespace std;
using namespace boost::numeric::ublas;
@xrq-phys
xrq-phys / Tensordot.jl
Last active November 28, 2023 17:56
Julia Implementation of NumPy's Tensordot Functon, Compatible with Flux/Zygote's Automatic Differentiation
"""
Tensordot.jl - Minimal Tensordot Implementation
Minimal tensordot for supporting Zygote's automatic differentiation.
This bunch of code is also compatible with FluxML's Tracker module.
"""
module Tensordot
using Zygote: @adjoint
using LinearAlgebra
@xrq-phys
xrq-phys / compile_MathLink_linux.sh
Last active April 10, 2023 19:35
Compile Wolfram Engine Backend for TeXmacs on Linux