This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
//@ts-check | |
import { argv } from 'node:process' | |
/** | |
Remove all base2 trailing zeroes. | |
More precisely, | |
it removes all least-significant unset bits | |
(digits of radix=2 numeral). | |
Equivalent to trial-division by 2. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
realias() { | |
if [ $# -ne 2 ]; then | |
echo "Usage: realias old_alias new_alias" | |
return 1 | |
fi | |
local o | |
o="$(alias -- "$1")" || { | |
printf %s "$o" | |
return 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 300 es | |
#ifdef GL_FRAGMENT_PRECISION_HIGH | |
precision highp float; | |
#else | |
precision mediump float; | |
#endif | |
uniform vec2 resolution; | |
uniform float time; | |
out vec4 fragColor; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f=x=>x>1?x*f(--x):(x^=x,x**x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main(){let mut n=7usize;while n!=0{print!("{n} ");n=[n*3+1,n/2][n%2]}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fn(x, n): | |
return (x/n + x*n) / 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -f | |
[ -n "$(dumpsys deviceidle | grep mScreenOn=false)" ] |
NewerOlder