Skip to content

Instantly share code, notes, and snippets.

View michaelmior's full-sized avatar
💭
👨‍💻

Michael Mior michaelmior

💭
👨‍💻
View GitHub Profile
@everdimension
everdimension / Input.tsx
Last active November 25, 2024 14:27
React Input element with support for customValidity props
/**
* Usage:
* <Input customValidity="your validation message" /> // add constraint
* or
* <Input customValidity="" /> // remove constraint
* or
* <Input defaultCustomValidity="you message" /> // initial validationMessage
*/
export function Input({
defaultCustomValidity,
@breadchris
breadchris / hybrid.py
Last active February 5, 2025 12:18
BM25 and FAISS hybrid search example
import numpy as np
from rank_bm25 import BM25Okapi
from sentence_transformers import SentenceTransformer
import faiss
class HybridSearch:
def __init__(self, documents):
self.documents = documents
# BM25 initialization
@SwampDragons
SwampDragons / README.md
Created June 7, 2022 16:49
Using a Nook Simple Touch in 2022

Using an old Barnes and Noble Nook Device

I got an ancient nook "simple touch" for free on a neighborhood Facebook group yesterday. Figured I could see if I at least like the form factor before getting myself a newer one.

Step 1: Charge it

When I got it, the battery was completely dead. I plugged it in to charge (thankfully a micro-USB charger). After about 20 minutes, it was ready to work on.

Step 2: Hardware Reset

@andy-thomason
andy-thomason / Genomics_A_Programmers_Guide.md
Created May 14, 2019 13:32
Genomics a programmers introduction

Genomics - A programmer's guide.

Andy Thomason is a Senior Programmer at Genomics PLC. He has been witing graphics systems, games and compilers since the '70s and specialises in code performance.

https://www.genomicsplc.com

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active March 1, 2025 08:27
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@postpostscript
postpostscript / replify
Last active November 7, 2024 02:47
replify - Create a REPL for any command
#!/bin/sh
command="${*}"
printf "Initialized REPL for `%s`\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
eval "$command $input"
printf "%s> " "$command"
@leonardofed
leonardofed / README.md
Last active March 5, 2025 19:03
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.