Skip to content

Instantly share code, notes, and snippets.

View toklok's full-sized avatar
💭
Permanent 418 status

Joseph Curtis toklok

💭
Permanent 418 status
View GitHub Profile

Encrypting data with AES128 in JavaScript

Usage

AES128 uses a 16 byte secret key.

const key = new Uint8Array(16);
crypto.getRandomValues(key);
@gd3kr
gd3kr / script.js
Created February 15, 2024 06:30
Download a JSON List of twitter bookmarks
/*
the twitter api is stupid. it is stupid and bad and expensive. hence, this.
Literally just paste this in the JS console on the bookmarks tab and the script will automatically scroll to the bottom of your bookmarks and keep a track of them as it goes.
When finished, it downloads a JSON file containing the raw text content of every bookmark.
for now it stores just the text inside the tweet itself, but if you're reading this why don't you go ahead and try to also store other information (author, tweetLink, pictures, everything). come on. do it. please?
*/
@johnwahba
johnwahba / leetcode_etl.rb
Last active October 6, 2023 01:22
Create an sqlite db of your leetcode visits and submissions to track progress
# Script runs on mac. Would need to be adapted to run on windows.
require 'sqlite3'
require 'json'
require 'zip'
require 'tmpdir'
require 'find'
# Function to unzip the file
def unzip_file(file, destination)
@Hebilicious
Hebilicious / cloudflare-pages-bun.env
Last active April 17, 2025 05:03
Cloudflare Pages and Bun
# Bun is now officially supported and these environments variables are no longer needed. Keeping this gist for legacy purposes.
# SKIP_DEPENDENCY_INSTALL=true
# UNSTABLE_PRE_BUILD=asdf install bun latest && asdf global bun latest && bun i
@ChrisHayduk
ChrisHayduk / merge_qlora_with_quantized_model.py
Last active April 18, 2025 08:23
Merging QLoRA weights with quantized model
"""
The code below combines approaches published by both @eugene-yh and @jinyongyoo on Github.
Thanks for the contributions guys!
"""
import torch
import peft
type Primitive = | null | undefined | string | number | boolean | symbol | bigint;
type LiteralUnion<LiteralType, BaseType extends Primitive,> = LiteralType | (BaseType & Record<never, never>);
export interface Shopify {
PaymentButton: {
init(): any
}
autoloadFeatures(param: any): any
/**
* Only show in Theme previews, it's a class instance, yuck.
@rememberlenny
rememberlenny / instructions.md
Last active April 6, 2023 01:32
GPT powered Poetic Git Commit Messages (Written by GPT-4)

In this guide, I'll show you how to create a Bash script that generates a short poem based on the changes made in your Git repository and uses it as a commit message. We'll integrate the OpenAI API to generate the poems and override the git commit -m command to use our custom script.

Step 1: Create the Poetic Commit Script

Create a file called poetic_commit.sh and paste the following code:

#!/bin/bash

# Save your OpenAI API Key in the OPENAI_API_KEY variable
@samleong123
samleong123 / readme.md
Last active May 5, 2025 14:43
Install Apple Music Preview on Windows 10 21H2 with Lossless Audio Support

Install Apple Music Preview on Windows 10 with Lossless Audio Support

Disclaimer

I will not be responsible on any inconvenience / damage / loss on behalf this tutorial nor the modified Apple Music Preview bundle.

Only for research purposes.

Minimum Tested System Requirement

System / Package Name Version
@Vogtinator
Vogtinator / README.md
Last active April 16, 2025 04:28
Run Win11 on ARM in QEMU

Guide updated to use the official installation .iso from Microsoft, which finally became available in Dec. 2024! For the VHDX disk image based guide check an earlier version of this gist.

When following this guide on a host not capable of aarch64 virtualization, replace -cpu host -accel kvm with -cpu max.

  1. Download the installation .iso from https://www.microsoft.com/en-us/software-download/windows11arm64. Win11_24H2_EnglishInternational_Arm64.iso is known to work.
  2. Download the the latest virtio-win.iso from https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/.
  3. Create a disk image for the Windows installation: qemu-img create -f qcow2 win11.qcow2 25G
  4. Start the installation with generic (ramfb for display, usb-storage for .isos) as well as virtio (virtio-gpu-pci, virtio-block) devices: `qemu-system-aarch64 -M virt -cpu host -accel kvm -m 4G -smp 4 -device ramfb -device virtio-gpu-pci -bios /usr/share/qemu/qemu-uefi-aarch64.bin -device qemu-xhci -device usb-kbd -dev
html {
--max-width: 1200px;
--columns: 6;
--gutter: 1.5rem;
}
* {
--grid: minmax(var(--gutter), 1fr)
repeat(
var(--columns),
minmax(