Skip to content

Instantly share code, notes, and snippets.

View ProfFan's full-sized avatar
🎯
Focusing

Fan Jiang ProfFan

🎯
Focusing
View GitHub Profile
@ProfFan
ProfFan / async_await_cancellation.md
Created December 19, 2023 18:18 — forked from Matthias247/async_await_cancellation.md
Async/Await - The challenges besides syntax - Cancellation

Async/Await - The challenges besides syntax - Cancellation

This is the second article in a series of articles around Rusts new async/await feature. The first article about interfaces can be found here.

In this part of the series we want to a look at a mechanism which behaves very different in Rust than in all other languages which feature async/await support. This mechanism is Cancellation.

@ProfFan
ProfFan / guide.md
Created September 5, 2023 23:24 — forked from othyn/guide.md
Fix horrendously bad macOS (12.3.1 tested) SMB (Samba) performance on Unraid

Intro

Out of the box, my SMB performance on macOS 12.3.1 would top out at around 20MB/s in short ~5 second bursts, which was absolutely horrendous, slow to navigate in Finder and slugish to interact with.

Since making these changes, I now get sustained ~80-100MB/s+ and instant Finder navigation which is superb and how things should be out-of-the-box (OOTB)!

May 2023 update: As of Ventura, the SMB issues were just horribly inconsistent and hard to maintain. Something in the combination of Unraid, macOS and SMB just doesn't play nice. I ended up binning NFS/SMB all together and heading to a locally hosted Nextcloud instance for file syncing, then using SFTP/Ansible Git flow for editing files within appdata.

Sources

@ProfFan
ProfFan / guide.md
Created September 5, 2023 23:24 — forked from othyn/guide.md
Fix horrendously bad macOS (12.3.1 tested) SMB (Samba) performance on Unraid

Intro

Out of the box, my SMB performance on macOS 12.3.1 would top out at around 20MB/s in short ~5 second bursts, which was absolutely horrendous, slow to navigate in Finder and slugish to interact with.

Since making these changes, I now get sustained ~80-100MB/s+ and instant Finder navigation which is superb and how things should be out-of-the-box (OOTB)!

May 2023 update: As of Ventura, the SMB issues were just horribly inconsistent and hard to maintain. Something in the combination of Unraid, macOS and SMB just doesn't play nice. I ended up binning NFS/SMB all together and heading to a locally hosted Nextcloud instance for file syncing, then using SFTP/Ansible Git flow for editing files within appdata.

Sources

@ProfFan
ProfFan / crash.swift
Created December 17, 2022 19:01
Swift crash
Building for debugging...
&&& Malformed rewrite rule: τ_0_0._Storage.[Sequence:Element].[_AdjacencyListPerVertex:EdgeData].[_AdjacencyListPerEdge:VertexId] => τ_0_0.[DirectedAdjacencyListProtocol:RawId]
&&& symbol.getKind() != Symbol::Kind::Name
Rewrite system: {
- [DirectedAdjacencyListProtocol].[DirectedAdjacencyListProtocol] => [DirectedAdjacencyListProtocol] [permanent]
- [DirectedAdjacencyListProtocol].RawId => [DirectedAdjacencyListProtocol:RawId] [permanent]
- [DirectedAdjacencyListProtocol]._EdgeData => [DirectedAdjacencyListProtocol:_EdgeData] [permanent]
- [DirectedAdjacencyListProtocol]._VertexData => [DirectedAdjacencyListProtocol:_VertexData] [permanent]
- [DirectedAdjacencyListProtocol].VertexCollection => [DirectedAdjacencyListProtocol:VertexCollection] [permanent]
@ProfFan
ProfFan / swift-api-crash-sr-13263.sil
Last active October 20, 2021 17:39
swift-api-crash-sr-13263.sil
// pullback of BatchNorm.callAsFunction(_:)
sil private @$s10TensorFlow9BatchNormV14callAsFunctionyAA0A0VyxGAGFAA0aB13FloatingPointRzlTJpUSpSr : $@convention(thin) <τ_0_0 where τ_0_0 : TensorFlowFloatingPoint> (@guaranteed Tensor<τ_0_0>, @owned _AD__$s10TensorFlow9BatchNormV14callAsFunctionyAA0A0VyxGAGF_bb6__PB__src_0_wrt_1_10TensorFlow0aB13FloatingPointRzl<τ_0_0>) -> @out BatchNorm<τ_0_0>.TangentVector {
// %0 // user: %440
// %1 // users: %211, %144
// %2 // user: %70
bb0(%0 : $*BatchNorm<τ_0_0>.TangentVector, %1 : $Tensor<τ_0_0>, %2 : $_AD__$s10TensorFlow9BatchNormV14callAsFunctionyAA0A0VyxGAGF_bb6__PB__src_0_wrt_1_10TensorFlow0aB13FloatingPointRzl<τ_0_0>):
%3 = metatype $@thin Tensor<τ_0_0>.Type // users: %238, %236, %219, %218, %418, %417, %414, %413, %346, %344, %340, %339, %337, %334, %330, %329, %304, %303, %294, %293, %171, %169, %152, %151, %126, %125, %121, %
import dearpygui.dearpygui as dpg
dpg.enable_docking(dock_space=True)
import numpy as np
width = 800
height = 800
grid_arr = np.ones((width, height, 4), dtype=np.float32)
rng = np.random.default_rng()
@ProfFan
ProfFan / paste_in_console.js
Created April 8, 2021 03:18
Springtax 1099 form helper
// This script helps you automatically fill each page of 1099 form when you have a consolidated 1099
// Just paste in the console each time you fill a new page
$("#__employer_details_employer_name").val("ABC INC")
$("#__employer_details_employer_address").val("ADDR AVE NE")
$("#__employer_details_employer_city").val("Palo Alto")
$("#__employer_details_employer_state").val("CA")
$("#__employer_details_employer_zip_code").val("943011")
$("#payers_federal_id").val("38-xxxxxxx")
$("#statecode").val("CA")
@ProfFan
ProfFan / swift.swift
Created March 30, 2021 23:56
swift.swift
let 🉑 = true;
class 🤣 {
let 💦: Int;
init() {
self.💦 = 1;
}
init(_ 💦: Int) {
@ProfFan
ProfFan / log.log
Last active February 14, 2021 23:21
SwiftFusion compile on latest Arch Swift nightly
swift build -Xcc -I/usr/include/tensorflow
Updating https://github.com/saeta/penguin.git
Updating https://github.com/dan-zheng/tensorboardx-s4tf.git
Updating https://github.com/apple/swift-tools-support-core.git
Updating https://github.com/tensorflow/swift-apis
Updating https://github.com/apple/swift-numerics
Updating https://github.com/pvieito/PythonKit.git
Updating https://github.com/google/swift-benchmark.git
Updating https://github.com/yaslab/CSV.swift.git
Updating https://github.com/vojtamolda/Plotly.swift
@ProfFan
ProfFan / chordal_grid3d.txt
Created June 18, 2020 20:26
Grid3D comparision
0.010068689239966268, 0.0016086790724621075, -0.0312696013842796
0.7447114712141675, 0.06205963228562672, -0.5573445530921713
1.409740980049445, 0.08655957953753346, -1.030334601927387
2.233505212825677, 0.15366358844952932, -1.6774906770770837
3.008689347558227, 0.28343220532336866, -2.2535724334656333
3.898977471592672, 0.33876676042302156, -2.7418953233705428
4.764607669726627, 0.47728574474871466, -3.489205029230695
5.505793867917641, 0.5567107296492837, -3.9723234574013357
6.315244378420935, 0.5955888262764261, -4.561362956443775
6.994184690768557, 0.7089548521732609, -5.251374427565788