Skip to content

Instantly share code, notes, and snippets.

@watertim
watertim / redelegate-evmos-all.sh
Last active November 27, 2021 13:54 — forked from apetresc/redelegate-cro.sh
A script to automatically claim staking rewards and re-stake them
#!/bin/bash -e
if [[ "$1" == "-h" || "$1" == "" ]]
then
echo "Usage: $0 <validator-address> [-y]"
exit
fi
# Arguments
VALIDATOR=$1
@davaymne
davaymne / Grafana - Main Page
Last active January 12, 2021 11:36
Grafana - Main Page
{
"__inputs": [
{
"name": "DS_GRAPHQL_DATA SOURCE",
"label": "GraphQL Data Source",
"description": "",
"type": "datasource",
"pluginId": "fifemon-graphql-datasource",
"pluginName": "GraphQL Data Source"
},
@ilap
ilap / grafana_telegram_bot.md
Last active May 9, 2025 23:43
Grafana Telegram Alert

Config Telegrambot for grafana's alerts.

1. Create bot

Open Telegram and search for @BotFather user and message them the following:

You
/newbot 

BotFather
@ad
ad / example.sql
Last active February 23, 2018 22:14
database with triggers and history example
CREATE OR REPLACE FUNCTION "json_append"(IN "data" json, IN insert_data json) RETURNS "json" AS $BODY$
SELECT ('{'||string_agg(to_json(key)||':'||value, ',')||'}')::json
FROM (
SELECT * FROM json_each(data)
UNION ALL
SELECT * FROM json_each(insert_data)
) t;
$BODY$
LANGUAGE sql
COST 100

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.

@ad
ad / ems.sh
Created March 27, 2017 08:44
Tracking EMS (Russian Post) parcel
#!/bin/bash
# usage: ems.sh <tracking> <sleep_duration>
export SLEEP=60
export TRACKING=""
if [ $1 ]; then
TRACKING="$1"
else
@PurpleBooth
PurpleBooth / README-Template.md
Last active January 1, 2026 21:42
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

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active December 26, 2025 12:02
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k