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.
#!/usr/bin/env node | |
//@ts-check | |
import assert from 'node:assert/strict' | |
import { argv } from 'node:process' | |
for (const arg of argv.slice(2)) { | |
// UX | |
const user_repo = (() => { | |
const a = arg.trim() | |
return a.slice( |
f=x=>x>1?x*f(--x):(x^=x,x**x) |
type numeric = number | bigint | |
const num_guard = (x: unknown): x is numeric => | |
typeof x == 'number' || typeof x == 'bigint' | |
const num_cond = <T,>(x: T) => ( | |
typeof x == 'number' || typeof x == 'bigint' | |
) as T extends numeric ? true : false | |
// this example is incomplete, |
#![warn(clippy::pedantic, clippy::nursery)] | |
use core::iter::successors; | |
use num_integer::{Integer, Roots}; //0.1 | |
pub fn divisors_fast<T: Integer + Roots + Clone>(x: &T) -> Vec<T> { | |
let sq = x.sqrt(); | |
let mut divs = Vec::new(); | |
let n1 = T::one(); |
use num_integer::Integer; // 0.1 | |
#[derive(Copy, Clone, Eq, PartialEq, Debug)] | |
enum S { | |
F, | |
B, | |
FB, | |
} | |
fn fb<T: Integer>(n: &T) -> Option<S> { |
fn main(){let mut n=7usize;while n!=0{print!("{n} ");n=[n*3+1,n/2][n%2]}} |
def fn(x, n): | |
return (x/n + x*n) / 2 |
#!/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 |