Skip to content

Instantly share code, notes, and snippets.

@nico-martin
nico-martin / VectorDB.ts
Last active May 5, 2024 13:46
An in-memory vectorDB for cosine similarity search in TypeScript that runs directly in the browser and uses TransformersJS for the embeddings.
// requires the experimental v3 of transformersJS:
// npm install xenova/transformers.js#v3
import { FeatureExtractionPipeline, pipeline } from "@xenova/transformers";
export interface Entry<T> {
str: string;
metadata: T;
}
export interface VectorizedEntry<T> extends Entry<T> {
@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active May 5, 2024 13:45
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
@ndavison
ndavison / hbh-header-abuse-test.py
Last active May 5, 2024 13:44
Attempts to find hop-by-hop header abuse potential against the provided URL.
# github.com/ndavison
import requests
import random
import string
from argparse import ArgumentParser
parser = ArgumentParser(description="Attempts to find hop-by-hop header abuse potential against the provided URL.")
parser.add_argument("-u", "--url", help="URL to target (without query string)")
@alexeygrigorev
alexeygrigorev / vimeo-download.py
Created September 17, 2016 09:09
Downloading segmented video from vimeo
import requests
import base64
from tqdm import tqdm
master_json_url = 'https://178skyfiregce-a.akamaihd.net/exp=1474107106~acl=%2F142089577%2F%2A~hmac=0d9becc441fc5385462d53bf59cf019c0184690862f49b414e9a2f1c5bafbe0d/142089577/video/426274424,426274425,426274423,426274422/master.json?base64_init=1'
base_url = master_json_url[:master_json_url.rfind('/', 0, -26) + 1]
resp = requests.get(master_json_url)
content = resp.json()
@tomdaley92
tomdaley92 / README.md
Last active May 5, 2024 13:39
Proxmox - SPICE Client setup for MacOS

Proxmox - SPICE client setup for MacOS

  1. Install a working (and compiled) version of virt-viewer. You may view the homebrew package's upstream source on GitHub.

    brew tap jeffreywildman/homebrew-virt-manager
    brew install virt-viewer
  2. Once that's installed should be able make a call remote-viewer with a pve-spice.vv file downloaded from proxmox web interface

@bruce-willis
bruce-willis / yunohost-oracle-free-tier.md
Last active May 5, 2024 13:37
How to setup YunoHost at Oracle free tier VM
  1. Register for Oracle Cloud Free Tier
  2. Create compute instance
    • change image to Canonical Ubuntu
    • confirm that a public IPv4 address is assigned
    • upload your public ssh key
    • leave everything blank in Boot volume
  3. Enable Internet Access
    • Instances → Instance details → Subnet → Default Security List → Add Ingress Rules
    • HTTP: Stateless: Checked
@kmobs
kmobs / DampingRatio.md
Last active May 5, 2024 13:36
Calculating the damping ratio for your hardware:

Prerequisite - Outdated. I don't use the resonance testing branch or pulses method anymore.

I recommend running Dmitry’s latest resonance testing branch and using the pulses method outlined below:

https://github.com/Klipper3d/klipper/issues/4560
https://github.com/dmbutyugin/klipper/tree/resonance-test-methods

I would only go down this path if you're getting ghosting with really high speed prints. On the Annex Engineering K3 for example, no matter how perfect the graphs looked, I was still getting some ghosting. That prompted me to go down this path. I'm now able to print at 20-30k acceleration, 250-350mm/s, and 15scv with perfect quality that can usually only be seen at significantly slower speeds.

The default settings in Klipper have the damping ratio set to .1. This should be fine for most people with sane settings. I like to go for the insane.

@OrionReed
OrionReed / dom3d.js
Last active May 5, 2024 13:35
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; // ¯\\_(ツ)_/¯
@kepano
kepano / obsidian-web-clipper.js
Last active May 5, 2024 13:34
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@nitred
nitred / optimal_mtu.md
Last active May 5, 2024 13:33
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file