Skip to content

Instantly share code, notes, and snippets.

View nopeless's full-sized avatar

nopeless nopeless

  • 07:00 (UTC -05:00)
View GitHub Profile
@nopeless
nopeless / gist:9609f5e45adc5b0032d6b7cba8e9ba69
Last active September 5, 2021 10:15
How to make private extension in vsc
cd %USERPROFILE%/.vscode/extensions
yo code
# if that errors do
npm install -g yo generator-code

# This is an important step
# I found this the hard way but without a "__metadata" in the package.json, you cannot set themes nor activate extensions
# So, here is a dummy payload that you can add to your package.json
@nopeless
nopeless / git commands.sh
Last active September 9, 2021 12:37
Git snippets
# basics
# oh frik the commit message was wrong
git commit -a --amend -m "new message"
# or
git commit -a --amend --no-edit
# set remote
git remote set-url origin url
# other stuff
@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);
@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 / 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 / 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 / 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 / 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 / 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 / README.md
Last active November 1, 2023 13:09
Python regex cheat sheet fast easy only examples

Official python re examples are so bad

Read this small note before you go

The python regex structure is mostly this
re.<method> is the go to interface with common signature as (pattern, string, flags=0)
and most of the time there is an equivalent Pattern.<method> with the first argument being the string instead of pattern
But the <method> has [, pos[, endpos]] and no flags=0 which might be useful
So I will omit all the equivalent methods' signatures