Skip to content

Instantly share code, notes, and snippets.

View srijan-paul's full-sized avatar
🍉
nom

injuly srijan-paul

🍉
nom
View GitHub Profile
@srijan-paul
srijan-paul / opcode_interpreter.zig
Last active August 5, 2024 16:05
Simple stack based interpreter.
const std = @import("std");
const Opcode = enum(u8) {
push,
add,
print,
exit,
eq, // pushes 1 if stack[-1] == stack[-2], 0 otherwise
jumpif_1,
jump,
@srijan-paul
srijan-paul / ext-version.ts
Last active March 14, 2024 04:51
Get a VSCode extension's version using the (undocumented) marketplace API.
// To use this in a `.js` file, just remove the type annotations.
/**
* (Makes reverse engineered internal API calls from https://marketplace.visualstudio.com)
* @param {string} extFullName Org name + "." + extension name. e.g: `"DeepSourceCorp.deepsource-vscode"`
* @returns The latest version of the DeepSource extension from the marketplace, as a semver string.
*/
async function fetchLatestExtensionVersion(extFullName: string): Promise<string | null> {
const resp = await fetch(
"https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery",
module Combinators
( result,
zero,
item,
sat,
char,
digit,
upper,
lower,
letter,
@srijan-paul
srijan-paul / bench.md
Last active July 18, 2021 10:34
Pallene benchmark results.

The below table shows the performance gain on upvalue box merging w.r.t the upvalue count.

Upvalue count Performance increase on upvalue box merging
2 1.06 ± 0.54
4 1.06 ± 0.51
8 1.18 ± 0.58
16 1.10 ± 0.45
32 1.27 ± 0.43
64 1.56 ± 0.28
import sys
import os
import re
argc = len(sys.argv)
default_params = "lua_State* L, Udata* G, StackValue* base, Udata* up"
def pln_entry_decl():
global default_params
import os
N = 1
def decls():
global N
s = ""
for i in range(1, N + 1):
s = s + f"\tlocal a{i}: integer = {i}" + '\n'
return s