Skip to content

Instantly share code, notes, and snippets.

View nopeless's full-sized avatar

nopeless nopeless

  • 14:20 (UTC -05:00)
View GitHub Profile
@nopeless
nopeless / f-razer.ps1
Last active March 24, 2024 22:35
uninstall razer script because the uninstaller doesn't properly uninstall
Set-PSDebug -Strict
Set-StrictMode -Version Latest
$WarningPreference = "Inquire"
$ErrorActionPreference = "Stop"
$rp = Get-Process | ? { $_ -like "*razer*" }
if ($rp -and $rp.Count -gt 0) {
Write-Host "Potential Razer processes:"
@nopeless
nopeless / check-prime.ts
Last active April 5, 2024 20:26
static prime checking using typescript types
// Prime checking regex, which this code is based off of
// https://regex101.com/r/RIJkGF/1
type StringDivisible<n extends string, div extends string> = n extends `` ? true : n extends `${div}${infer r}` ? StringDivisible<r, div> : false;
type Substrings<n extends string, d extends string = ""> = n extends `${d}${infer r}` ? readonly [` ${d}`, ...Substrings<r, ` ${d}`>] : readonly [];
type StringFactors<n extends string> = Substrings<n> extends readonly [unknown, ...infer R extends readonly string[], unknown] ? R : never;
type StringIsPrime<n extends string, Factors extends readonly string[] = StringFactors<n>> = Factors extends readonly [infer s extends string, ...infer R extends readonly string[]] ? StringDivisible<n, s> extends true ? false : StringIsPrime<n, R> : true;
type RepeatStringByStringDigit<str extends string, d extends string> =