Skip to content

Instantly share code, notes, and snippets.

View nopeless's full-sized avatar

nopeless nopeless

  • 03:30 (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 / lua-build.ps1
Created October 10, 2023 19:26
Simple Lua build script for Windows using MSVC
<#
Instructions:
Clone/download Lua source code from https://www.lua.org
Run this script from the root of the source code directory
You may need to install Visual Studio build tools with MSVC compiler
#>
@nopeless
nopeless / async-string-splitter.md
Last active March 13, 2023 23:22
A challenge for myself

When splitting a large string, it is best to use a worker thread, microservice, or a lambda. However, if you are looking into event-loop based solutions, you have to leverage JavaScript's api for scheduling tasks.

Code:

const createAwaitTick = () => ({ then(fn) { setImmediate(fn) } });

async function *_charGenerator(str, batchSize) {
    let i = batchSize
    for (const c of str) {
@nopeless
nopeless / check-prime.ts
Last active December 1, 2023 01:55
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> =
@nopeless
nopeless / star.html
Created April 16, 2022 17:45
star with shadow svg
<div style="width: 40px; aspect-ratio: 1 / 1;">
<svg class="star-svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/2000/xlink" width="21px" height="24px">
<path style="fill: black; transform: translate(2.1px, 2.4px)" d="M 0 0.054 Z M 15.422 18.129 L 10.158 15.361 L 4.893 18.129 L 3 16 l 1.006 -5.863 l -4.259 -4.152 l 5.887 -0.855 l 2.632 -5.334 l 2.633 5.334 l 5.885 0.855 L 18.677 8.114 L 14.419 12.266 L 15.422 18.129 Z"></path>
<path style="fill: cyan;" d="M 0 0.054 z M 15.422 18.129 l -5.264 -2.768 l -5.265 2.768 l 1.006 -5.863 L 1.64 8.114 l 5.887 -0.855 l 2.632 -5.334 l 2.633 5.334 l 5.885 0.855 l -4.258 4.152 L 15.422 18.129 z"></path>
</svg>
</div>
@nopeless
nopeless / tut.md
Created April 15, 2022 05:59
python tutorial

A short, concise introduction to programming with Python

What does it mean to "program"

Programming stands for the abstraction and translation of real life instructions into instructions that a computer can understand.

Many people don't quite grasp the difference between the process of computers, so I will list core differences below.

Computers are based on the Turing machine

@nopeless
nopeless / lcs in javascript.
Created December 9, 2021 15:30
I make 3D lcs in javascript
var crypto = require(`crypto`);
// var a = crypto.randomBytes(20).toString(`hex`);
// var b = crypto.randomBytes(20).toString(`hex`);
// var c = crypto.randomBytes(20).toString(`hex`);
var a = `acc3be0ffe08a5a37546ff6f31c8eab2ce11bd7e`;
var b = `0ded06494ff6017e86257f15f12db11e09ec2664`;
var c = `630fea9f3c2d173718a53d5488f3b53b22e35f88`;
const abc = Array.from({length: a.length + 1}, () =>
@nopeless
nopeless / arithmetic tokenizer.js
Created November 30, 2021 22:22
i speed run arithmetic operation tokenization in 90 minutes
/* eslint-disable consistent-return */
class TokenType {
constructor(type, regex) {
this.type = type;
this.regex = regex;
}
match(s) {
@nopeless
nopeless / a.js
Created September 26, 2021 02:55
Discord Intents ALL
const { Intents } = require("discord.js");
Intents.ALL = Object.values(Intents.FLAGS).reduce((acc, p) => acc | p, 0);