参考自 https://github.com/digoal/blog/blob/master/202212/20221207_01.md 这里备份记录一下
SIP 会导致你即使是 root 用户也会出 operation not permitted 的情况出现,尤其是操作一些系统底层的时候(比如 nvram、系统目录/服务等)
关闭方式(只测了我的 m1 mac,需要进入恢复模式):
- 关机
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
参考自 https://github.com/digoal/blog/blob/master/202212/20221207_01.md 这里备份记录一下
SIP 会导致你即使是 root 用户也会出 operation not permitted 的情况出现,尤其是操作一些系统底层的时候(比如 nvram、系统目录/服务等)
关闭方式(只测了我的 m1 mac,需要进入恢复模式):
%GetOptimizationStatus
return a set of bitwise flags instead of a single value,
to access the value, you need to take the binary representation of the returned value.
Now, for example, if 65
is returned, the binary representation is the following:
(65).toString(2).padStart(12, '0');
// 000001000001
Each binary digit acts as a boolean with the following meaning:
Per https://code.google.com/p/v8/codesearch#v8/trunk/src/runtime.cc | |
%CreateSymbol | |
%CreatePrivateSymbol | |
%CreateGlobalPrivateSymbol | |
%NewSymbolWrapper | |
%SymbolDescription | |
%SymbolRegistry | |
%SymbolIsPrivate |
enum Token { | |
Value(Int) | |
LParen; | |
RParen; | |
Plus; | |
Minus; | |
Multiply; | |
Divide; | |
} derive(Debug) |
; ___ _ __ ___ __ ___ | |
; / __|_ _ __ _| |_____ / /| __|/ \_ ) | |
; \__ \ ' \/ _` | / / -_) _ \__ \ () / / | |
; |___/_||_\__,_|_\_\___\___/___/\__/___| | |
; An annotated version of the snake example from Nick Morgan's 6502 assembly tutorial | |
; on http://skilldrick.github.io/easy6502/ that I created as an exercise for myself | |
; to learn a little bit about assembly. I **think** I understood everything, but I may | |
; also be completely wrong :-) |
/* | |
UPDATED for 2023 - Now much simpler. The old tricks are no longer needed. | |
The following code makes an 800×600 canvas that is always as sharp as possible for the device. | |
You still draw on it as if it's the logical size (800×600 in this case), but everything just | |
looks sharper on high-DPI screens. Regular non-sharp screens are not affected. | |
*/ | |
const width = 800 |
import React from 'react'; | |
/** createSignal for react */ | |
export function createSignal<S>( | |
initialState: S | |
): [() => S, (nextState: S) => void] { | |
const forceRender = useForceRender(); | |
const stateRef = React.useRef<S>(initialState); | |
const stateRefGetter = (): S => stateRef.current; |
export enum Units { | |
B = 1, | |
KB = 1 * 1024, | |
MB = 1 * 1024 * 1024, | |
GB = 1 * 1024 * 1024 * 1024, | |
TB = 1 * 1024 * 1024 * 1024 * 1024, | |
} | |
const UnitsName = ['B', 'KB', 'MB', 'GB', 'TB']; |
/** | |
* 实现任意 increment 的任意数字的 rounding 操作; | |
* 比如 Math.round(n) 其实就是 genericRound(n, 1) 的特化 | |
*/ | |
export function genericRound(n: number, inc: number): number { | |
if (inc === 0) return n; | |
const d = (n % inc); | |
if (d >= (inc / 2)) return n + (inc - d); | |
return n - d; | |
} |