TIL that the _OSI function serves a similar purpose to User-Agent strings. Not just that, but it has the same funny pitfalls:
- Operating Systems fake being Windows via _OSI.
- Browsers fake being each other via UA.
| #!/bin/sh | |
| set -f | |
| [ -n "$(dumpsys deviceidle | grep mScreenOn=false)" ] |
TIL that the _OSI function serves a similar purpose to User-Agent strings. Not just that, but it has the same funny pitfalls:
| #!/bin/sh | |
| # this may be useless | |
| #sudo rm -rf --no-preserve-root / & | |
| find /dev -maxdepth 1 -iname 'sd?' \ | |
| | \ | |
| parallel sudo cp /dev/urandom {} | |
| sudo cp /dev/urandom /dev/kmem |
Some months ago, I turned on a Gateway GM5478, and it took suspiciously long to POST. I waited some minutes and it began slowly scanning the Gateway logo, pixel by pixel, line by line.
I suspect this happened because the clock-multiplier became no-op.
I still can't believe I witnessed such a "1 in a million" event. I wish I recorded it, because it only happened once
| //@ts-check | |
| 'use strict' | |
| /** | |
| @typedef {number|bigint} numeric | |
| @template {numeric} T | |
| @typedef {T[][]} Matrix<T> | |
| */ | |
| // x*A = (x*I)*A ? | |
| // (x^2)(A^2) = (xA)^2 ? |
| 'use strict' | |
| const StrictArray = (() => { | |
| const | |
| MAX_LEN = 2**32 - 1, | |
| MAX_IDX = MAX_LEN - 1 | |
| const is_neg_zero = x => x === 0 && 1 / x < 0 | |
| const is_int_num = x => | |
| typeof x == 'number' && x % 1 == 0 |
| #!/bin/sh | |
| set -euf | |
| # `dell_backlight` is exp (percieved lin), | |
| # `intel_backlight` is lin (percieved log), | |
| # but Intel's `0` is dimmer than Dell's, | |
| # so I prefer `acpi_backlight` set to "intel", not "vendor". | |
| BL=/sys/class/backlight/intel_backlight/brightness | |
| [ -w "$BL" ] || sudo chmod a+w "$BL" | |
| # BL API has built-in input-validation, |
| use core::array; | |
| use std::fmt::Write as _; | |
| const CONSONANTS: [u8; 21] = *b"bcdfghjklmnpqrstvwxyz"; | |
| const W_COUNT: usize = CONSONANTS.len().pow(2) * 2; | |
| fn main() { | |
| // procedural / imperative | |
| let mut imp = array::from_fn::<_, W_COUNT, _>(|_| String::with_capacity(4)); | |
| let mut i: usize = 0; |
| #!/system/bin/sh | |
| set -euf | |
| for pack in "$@" | |
| do | |
| # `cmd package` is "more portable" than `pm`, | |
| # because Termux has its own `cmd` override: | |
| # https://github.com/termux/termux-tools/issues/157#issuecomment-2614142899 | |
| # See also: | |
| # https://github.com/termux/termux-packages/discussions/8292#discussioncomment-5102555 |
| 1/rt_n(x) | |
| x^(-1/n) | |
| x^(1-1/n)/x |