Skip to content

Instantly share code, notes, and snippets.

View Oil3's full-sized avatar

Quet Almahdi Morris Oil3

View GitHub Profile
@Oil3
Oil3 / gist:82fb57a47adcc7c1a81db69f115c3b83
Last active March 2, 2024 04:36
WKWebView search / find for MacOS swift
//Actually it is built-in for Mac as well, no need of 3 pages of Js,
//In the contentview:
@State private var searchText = ""
//inside its navigationsplitview/stack the automatic field
.searchable(text: $searchText)
//In the view:
DEFAULT PERSIST_OFF
sudo log config --subsystem com.apple.bluetooth --mode level:default,persist:off
sudo log config --subsystem com.apple.powerd --mode level:default,persist:off
sudo log config --subsystem com.apple.SkyLight --mode level:default,persist:off
sudo log config --subsystem com.apple.runningboard --mode level:default,persist:off
sudo log config --subsystem com.apple.amp.mediaremote --mode level:default,persist:off
import onnx
model = onnx.load("path_to_your_model/model.onnx")
print("Inputs: ", [input.name for input in model.graph.input])
print("Outputs: ", [output.name for output in model.graph.output])
@Oil3
Oil3 / gist:1ec3af85a37b725017936c6ad7952149
Created December 19, 2023 09:53
mac get gpu info/device id
system_profiler SPDisplaysDataType
@Oil3
Oil3 / dec082023.py
Created December 9, 2023 00:07
mps pytorch from some codeformer
IS_HIGH_VERSION = [int(m) for m in list(re.findall(r"^([0-9]+)\.([0-9]+)\.([0-9]+)([^0-9][a-zA-Z0-9]*)?(\+git.*)?$",\
torch.__version__)[0][:3])] >= [1, 12, 0]
def gpu_is_available():
if IS_HIGH_VERSION:
if torch.backends.mps.is_available():
return True
return True if torch.cuda.is_available() and torch.backends.cudnn.is_available() else False
def get_device(gpu_id=None):