Skip to content

Instantly share code, notes, and snippets.

View chfanghr's full-sized avatar
🏃‍♂️
Running away from the POOH

方泓睿 chfanghr

🏃‍♂️
Running away from the POOH
View GitHub Profile
@GrantMoyer
GrantMoyer / sugarcane.ipynb
Last active March 18, 2025 12:14
Sugar Cane Yield v.s. Harvest Period
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@spencerpogo
spencerpogo / json2nix.py
Last active June 10, 2024 06:42
Converts JSON objects into nix (hackishly).
"""Converts JSON objects into nix (hackishly)."""
import sys
import json
INDENT = " " * 2
def strip_comments(t):
@SteveCooling
SteveCooling / jbod.md
Created January 27, 2021 21:06
MegaCli enable JBOD

Enable JBOD on the controller

/opt/MegaRAID/MegaCli/MegaCli64 -AdpSetProp -EnableJBOD 1 -a0

Put drives in "UnconfiguredGood" state

/opt/MegaRAID/MegaCli/MegaCli64 -pdmakegood -physdrv [252:0,252:1,252:2,252:3,252:4,252:5] -force –a0

Make drives JBOD

@niw
niw / README.en.md
Last active March 30, 2025 06:00
How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

How to run Windows 10 on ARM or Ubuntu for ARM64 in QEMU on Apple Silicon Mac

Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac. Enjoy!

NOTE: that this is current, 10/1/2021 state.

Running Windows 10 on ARM

  1. Install Xcode from App Store or install Command Line Tools on your Mac
/* So how does this work?
I'm using ANSI escape sequences to control the behavior of the terminal while
cat is outputting the text. I deliberately place these control sequences inside
comments so the C++ compiler doesn't try to treat them as code.*/
//
/*The commands in the fake code comment move the cursor to the left edge and
clear out the line, allowing the fake code to take the place of the real code.
And this explanation uses similar commands to wipe itself out too. */
//
#include <cstdio>
@waylybaye
waylybaye / Measure.swift
Last active March 12, 2024 14:09
SwiftUI view render performance Indicator
// Created by Baye Wayly on 2020/3/13.
// Copyright © 2020 Baye. All rights reserved.
import SwiftUI
struct Measure<Content: View>: View {
@State var cost: TimeInterval = 0
var content: Content
init(@ViewBuilder builder: () -> Content) {
@M-rcus
M-rcus / cyberdrop-album-select-sort.user.js
Last active November 14, 2022 20:42
Userscript to alphabetically sort the album select when uploading to CyberDrop (or other Lolisafe instances)
// ==UserScript==
// @name CyberDrop - Sort Album Select and More
// @namespace github.com/M-rcus
// @match https://cyberdrop.me/
// @match https://bunkr.is/
// @grant none
// @version 2.5.2
// @author Maarcus
// @description Automatically sorts the album select alphabetically once page loads on CyberDrop... and some other QoL changes.
// @downloadUrl https://gist.github.com/M-rcus/dfea1ecd288cc3be5f493eb7f52e45e1/raw/cyberdrop-album-select-sort.user.js
@bw2012
bw2012 / ue4_enable_c++17.txt
Last active April 7, 2024 07:09
How to enable C++17 in UE4 and Visual Studio 2017
Tested with UE 4.21
1. Open your UE4 engine folder [Program files or something else you like]\Epic Games\UE_4.21\Engine\Source\Programs\UnrealBuildTool
2. Open file Epic Games\UE_4.21\Engine\Source\Programs\UnrealBuildTool\Platform\Windows\VCToolChain.cs
3. Find method void AppendCLArguments_CPP(CppCompileEnvironment CompileEnvironment, List<string> Arguments)
4. Add Arguments.Add("/std:c++17"); to begin of method
5. Open Epic Games\UE_4.21\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj in MSVS 2017
6. Rebuild UnrealBuildTool
7. Open your project and rebuild it
8. Enjoy c++17 features
@dagli
dagli / proxifier_trial_reset.bat
Last active March 24, 2025 06:46
Proxifier Trial Reset
REM Initex Software Proxifiertrial reset
REM Close Proxifier if it is running
taskkill /f /im Proxifier.exe
reg delete "HKCU\SOFTWARE\Microsoft\Internet Explorer\Main" /v DefaultWANProfile /f
reg delete "HKCU\Software\Initex\ProxyChecker\Settings" /v DefaultWANProfile /f
reg delete "HKCU\Software\Initex\Proxifier\Settings" /v DefaultWANProfile /f
REM Delete "DefaultWANProfile" line in "Settings.ini" file in ProxifierPE folder (for Portable Edition)
del %~dp0Settings.old.ini
@masklinn
masklinn / cheatsheet.md
Last active April 17, 2025 02:20
launchctl/launchd cheat sheet

I've never had great understanding of launchctl but the deprecation of the old commands with launchctl 2 (10.10) has been terrible as all resources only cover the old commands, and documentation for Apple utilities is generally disgracefully bad, with launchctl not dissembling.

Mad props to https://babodee.wordpress.com/2016/04/09/launchctl-2-0-syntax/ which contains most details

domains

Internally, launchd has several domains, but launchctl 1 would only ask for service names,