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
@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?
*/
@hayden-donnelly
hayden-donnelly / make_crop_labels.py
Last active January 27, 2024 04:29
Script to make square crop labels for images.
# Example usage:
# python make_crop_labels.py --input_path data/images --output_path --data/cropped_images --csv_path data/crops.csv
# Controls:
# scroll to change crop size, mouse to aim the crop, left click to crop image and move to next, x to skip to the next image.
# The script is pretty messy since I quickly hacked it together with little regard for quality, but it works.
import pygame
import argparse
@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 10, 2024 01:01
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 10, 2024 00:36
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

Inject addEventListener hook

With (Tamper|Violent|Grease)monkey, you can run any JavaScript code on any web pages. This allows you to rewrite the content and style of web pages and override their behaviors. However, manipulating the event listeners is a bit more difficult. In particular, to disable or delete a registered event listener, you must have a reference to the event listener function object, which is usually not available. Chrome DevTools (or similar browser developer functionalities) can do this, but in any case it is not available from Tampermonkey.

This code snippet will help you to remove event listeners by inserting a hook into EventTarget.proptotype.addEventListener, the standard method for registering event listeners, and logging all calls to it. For example, to remove all click events, you can use the following code:

//...
(function() {
    'use strict';
    window.addEventListene
html {
--max-width: 1200px;
--columns: 6;
--gutter: 1.5rem;
}
* {
--grid: minmax(var(--gutter), 1fr)
repeat(
var(--columns),
minmax(
@LordGhostX
LordGhostX / fauna-auth-demo.py
Last active April 1, 2022 18:41
Gist showing Fauna's user identity and session management capabilities
from faunadb import query as q
from faunadb.objects import Ref
from faunadb.client import FaunaClient
from faunadb.errors import BadRequest, Unauthorized
client = FaunaClient(secret="YOUR-SECRET-HERE")
def create_user(email, password):
result = False