Skip to content

Instantly share code, notes, and snippets.

View bquast's full-sized avatar
👋

Bastiaan Quast bquast

👋
View GitHub Profile
# --- Dataset Setup ---
input_file <- "input.txt"
if (!file.exists(input_file)) {
names_url <- "https://raw.githubusercontent.com/karpathy/makemore/refs/heads/master/names.txt"
download.file(names_url, input_file)
}
lines <- readLines(input_file, warn = FALSE)
docs <- lines[nchar(trimws(lines)) > 0]
set.seed(42)
name cloudflare-pages-vanilla-preferences
description Follow Bastiaan's Cloudflare Pages preferences when discussing, advising on, generating code for, or debugging Cloudflare Pages projects (especially vanilla HTML/CSS/JS setups). Use this skill whenever the user mentions Cloudflare Pages, Pages Functions, wrangler, static sites on Pages, vanilla JS, routing, dynamic routes, file structure, or related issues.
version 1.4
author Bastiaan Quast (@baquast)

Core Preferences & Rules – Always Obey These

Project Structure & Files – Static Assets

// ==UserScript==
// @name Grokipedia Search Result Copy URL
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Adds a copy URL button to each search result on the Grokipedia search results page.
// @author Bastiaan Quast
// @match https://grokipedia.com/search*
// @grant GM_setClipboard
// @grant GM_addStyle
// @run-at document-idle
const { Readability } = require('@mozilla/readability');
const jsdom = require('jsdom');
const fs = require('fs');
const path = require('path');
const os = require('os');
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
// Helper to download an image and return the local filename
async function downloadImage(imgUrl, folder, idx) {
try {
import numpy as np
from numpy.polynomial import Polynomial
def polynomial_modulo(polynomial, mod):
q, r = divmod(polynomial, mod)
return r
def mod_on_coefficients(polynomial, modulo):
coefs = polynomial.coef
mod_coefs = [c % modulo for c in coefs]
## ----setup----
library(polynom)
library(HEtools)
## ----params----
d = 4
n = 2^d
p = (n/2)-1
t = p
q = 868
// ==UserScript==
// @name Google Docs Side Panel Hide
// @namespace http://tampermonkey.net/
// @version 2024-04-21
// @description Hide the Google Docs Side Panel (Calendar, Keep, Maps, etc.) toggle button for a clean slate.
// @author Bastiaan Quast
// @match https://docs.google.com/document/d/*
// @icon none
// @grant GM_addStyle
// ==/UserScript==
@bquast
bquast / BGV-2.py
Created January 3, 2024 14:05
BGV in Python
import numpy as np
from numpy.polynomial import Polynomial
def polynomial_modulo(polynomial, mod):
"""
Perform polynomial modulo operation using divmod.
"""
q, r = divmod(polynomial, mod)
return r
@bquast
bquast / BFV-2.py
Last active January 3, 2024 13:56
BFV in python without using functions
import numpy as np
from numpy.polynomial import Polynomial
def polynomial_modulo(polynomial, mod):
"""
Perform polynomial modulo operation using divmod.
"""
q, r = divmod(polynomial, mod)
return r
@bquast
bquast / CKKS-encoder.R
Last active December 23, 2023 23:18
Homomorphic Encryption CKKS encoder R
library(polynom)
M <- 8
N <- M %/% 2
scale <- 64
xi <- complex(real = cos(2 * pi / M), imaginary = sin(2 * pi / M))
vandermonde <- function(xi, M) {
N <- M %/% 2
# Initialize an empty matrix with complex data type