Skip to content

Instantly share code, notes, and snippets.

@OrionReed
OrionReed / dom3d.js
Last active April 25, 2024 06:09
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@jart
jart / rename-pictures.sh
Created December 12, 2023 15:24
Shell script for renaming all images in a folder
#!/bin/sh
# rename-pictures.sh
# Author: Justine Tunney <jtunney@gmail.com>
# License: Apache 2.0
#
# This shell script can be used to ensure all the images in a folder
# have good descriptive filenames that are written in English. It's
# based on the Mistral 7b and LLaVA v1.5 models.
#
# For example, the following command:
@mw3i
mw3i / django-database-standalone.py
Last active April 23, 2024 11:48
Truly Standalone Django-ORM Wrapper
'''
Proof of Concept:
Django devs built an ORM that seems way more straightforward than many existing tools. This class lets you leverage the django-orm without any project settings or other aspects of a django setup.
There are probably weak points and functionality missing, but it seems like a relatively intuitive proof of concept
'''
import os
import django
from django.conf import settings
@cquangc
cquangc / app.py
Created June 30, 2023 05:26 — forked from vovavili/app.py
Streamlit + Firebase authorization example
"""Module for handling authentication, interactions with Firebase and JWT cookies.
This solution is refactored from the ‘streamlit_authenticator’ package . It leverages JSON
Web Token (JWT) cookies to maintain the user’s login state across browser sessions. For the
backend, It uses Google’s Firebase Admin Python SDK. This solution ensures that the content
of the page and user settings panel are only displayed if the user is authenticated. Similarly,
the login page can only be accessed if the user is not authenticated. Upon registration, the
user is sent a verification link to their e-mail address.
Important - to make this app run, put the following variables in your secrets.toml file:
COOKIE_KEY - a random string key for your passwordless reauthentication
@jpenalbae
jpenalbae / peek.sh
Last active March 19, 2024 16:11
Record desktop area on linux using slop and ffmpeg
#!/bin/bash
# Video Quality
# The range of the CRF scale is 0–51, where 0 is lossless, 23 is the default,
# and 51 is worst quality possible. A lower value generally leads to higher
# quality, and a subjectively sane range is 17–28
QUALITY=28
# check if slop command exists
if ! command -v slop &> /dev/null
@lxe
lxe / README.md
Last active February 27, 2024 21:19
How to get oobabooga/text-generation-webui running on Windows or Linux with LLaMa-30b 4bit mode via GPTQ-for-LLaMa on an RTX 3090 start to finish.

How to get oobabooga/text-generation-webui running on Windows or Linux with LLaMa-30b 4bit mode via GPTQ-for-LLaMa on an RTX 3090 start to finish.

This guide actually works well for linux too. Just don't bother with the powershell envs

  1. Download prerequisites

  2. (Windows Only) Open the Conda Powershell.

@petejohanson
petejohanson / .config
Created September 25, 2021 18:19
Zaphod config
#
# ZMK
#
#
# Basic Keyboard Setup
#
CONFIG_ZMK_KEYBOARD_NAME="Zaphod"
CONFIG_USB_DEVICE_PRODUCT="Zaphod"
@toricls
toricls / lima-on-m1-mac-installation-guide.md
Last active February 28, 2024 10:39
Using Lima to run containers with containerd and nerdctl (without Docker Desktop) on M1 Macs

Lima (Linux virtual machines, on macOS) installation guide for M1 Mac.

Sep. 27th 2021 UPDATED

Now we can install patched version of QEMU via Homebrew (thank you everyone for the info!). Here is the updated instruction with it:

Used M1 Mac mini 2020 with macOS Big Sur Version 11.6.

1. Install QEMU & Lima

# In order to use this you need to increase max_extrude_cross_section in your extruder config or klipper will complain. I set mine to 30
[gcode_macro PURGE_BLOB]
gcode:
# This is for a 300mm bed. If you have a diferent bed size you may want to adjust the line below
{% set rand_pos = (105 + ( printer.system_stats.cputime * 1000 ) % 60) %} ; Generate pseudo random start pos so we dont wear out that one spot on the bed.
M117 Purging at X{ rand_pos }
# The start pos will be within the "handle" of the flex plate where there is some extra Y space available so we can go all the way to Y0
# If your setup does not have this extra space then just increase the y valie in the line "G1 X{ rand_pos } Y0 Z1 F18000"
G92 E0 ; zero the extruder
@tykurtz
tykurtz / grokking_to_leetcode.md
Last active April 25, 2024 06:31
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window