Skip to content

Instantly share code, notes, and snippets.

View ProfFan's full-sized avatar
🎯
Focusing

Fan Jiang ProfFan

🎯
Focusing
View GitHub Profile
@MCterra10
MCterra10 / install_ndproxy.sh
Last active March 19, 2025 12:03
ndproxy Install Script for OPNSense (run with sudo)
#!/bin/sh
# save previous working directory to preserve state
PWD=$(pwd)
# download the opnsense OS source
echo ">>> Downloading OPNsense Source Code..."
rm -r /usr/src
git clone --recurse-submodules https://github.com/opnsense/src /usr/src
cd /usr/src
@othyn
othyn / guide.md
Last active June 30, 2025 15:00
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

@imbushuo
imbushuo / Vibrator.cs
Last active November 2, 2019 10:57
Turn your Apple Magic Trackpad 2 into a vibrator
using HidSharp;
using System.Linq;
namespace ForceTouchTrigger
{
class Program
{
static void Main(string[] args)
{
// Force Touch Device: USB\VID_05AC&PID_0265&MI_02
@tomtastic
tomtastic / smb.conf
Last active January 27, 2025 13:27
Samba 4.13.5 config for MacOS Monterey
#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
@Matthias247
Matthias247 / async_await_cancellation.md
Created May 28, 2019 06:09
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.

extension Array where Element: Differentiable {
/// Views the array as the differentiable product manifold of `Element` with itself `count` times.
public struct DifferentiableView: Differentiable {
/// The array that we are viewing.
public var base: [Element]
/// Construct a view of the given array.
public init(_ base: [Element]) { self.base = base }
// MARK: - Differentiable conformance.
@zznop
zznop / mem-loader.asm
Last active June 6, 2025 11:29
Fun little loader shellcode that executes an ELF in-memory using an anonymous file descriptor (inspired by https://x-c3ll.github.io/posts/fileless-memfd_create/)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (C), zznop, [email protected]
;;;
;;; This software may be modified and distributed under the terms
;;; of the MIT license. See the LICENSE file for details.
;;;
;;; DESCRIPTION
;;;
;;; This PoC shellcode is meant to be compiled as a blob and prepended to a ELF
@dan-zheng
dan-zheng / _DynamicParameters.md
Last active December 15, 2019 06:03
Dynamic parameters and `allKeyPaths` synthesis
@74th
74th / tensorflow_1.8.0_macos_nvidia.patch
Created May 3, 2018 13:01
TensorFlow v1.8.0 MacOS Nvidia GPU
diff --git a/tensorflow/core/framework/variant.h b/tensorflow/core/framework/variant.h
index c02391dae3..7f76609814 100644
--- a/tensorflow/core/framework/variant.h
+++ b/tensorflow/core/framework/variant.h
@@ -152,7 +152,8 @@ bool DecodeVariant(const string& buf, T* value);
//
class Variant {
public:
- constexpr Variant() noexcept = default;
+// constexpr Variant() noexcept = default;
@dantmnf
dantmnf / fonts.sh
Last active February 26, 2024 12:51
one-key script to set correct font family fallbacks on Arch Linux (and maybe other distros)
#!/bin/bash
if (( EUID != 0 ))
then
echo "I need root!"
exit 1
fi
echo "writing /etc/fonts/conf.d/79-order.conf"
cat > /etc/fonts/conf.d/79-order.conf <<EOFC
<?xml version='1.0'?>