Skip to content

Instantly share code, notes, and snippets.

View antoniobg's full-sized avatar
🏠
Working from home

Antonio Borrero Granell antoniobg

🏠
Working from home
View GitHub Profile
@bisho
bisho / DIVISORS.md
Last active April 16, 2024 10:12
Tool to help choosing a great # of shards

Tool to help choosing a great # of shards

What is this for?

This tool finds numbers with a high number of divisors. Having a lot of divisors is a property that makes them a great choice as the number of partitions to use for sharding.

It also has the concept of "usable divisors", those that provide an increase greater or equal to some % (20% by default). Rebalancing has some operational costs and risks, so you usually wouldn't want to rebalance to achieve less

import subprocess
import time
from typing import Optional
import requests
TELEGRAM_BOT_API_KEY = '<telegram_api_key>'
TELEGRAM_CHAT_ID = '<telegram_chat_id>'
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 1, 2024 17:49
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)