Skip to content

Instantly share code, notes, and snippets.

View nkbt's full-sized avatar
💚

Nikita Butenko nkbt

💚
View GitHub Profile
@nkbt
nkbt / empty_bucket.sh
Created February 3, 2020 00:03 — forked from wknapik/empty_bucket.sh
Empty an s3 bucket of all object versions and delete markers in batches of 1000
#!/usr/bin/env bash
set -eEo pipefail
shopt -s inherit_errexit >/dev/null 2>&1 || true
if [[ ! "$#" -eq 2 || "$1" != --bucket ]]; then
echo -e "USAGE: $(basename "$0") --bucket <bucket>"
exit 2
fi
@nkbt
nkbt / example.jsx
Created May 2, 2019 04:33 — forked from bvaughn/LICENSE.md
Advanced example for manually managing subscriptions in an async-safe way using hooks
import React, { useMemo } from "react";
import useSubscription from "./useSubscription";
// In this example, "source" is an event dispatcher (e.g. an HTMLInputElement)
// but it could be anything that emits an event and has a readable current value.
function Example({ source }) {
// In order to avoid removing and re-adding subscriptions each time this hook is called,
// the parameters passed to this hook should be memoized.
const subscription = useMemo(
() => ({