Skip to content

Instantly share code, notes, and snippets.

Table friends

in a lounge layout, join a table with camera on and mic off, then run this bookmarklet

@andymatuschak
andymatuschak / gist:c5f2b8b68821a95e5b339bfcd4bfcee1
Last active July 21, 2020 16:59
late-bound React hook callbacks, avoiding subtree re-renders when event callback deps change
function useWeakRef<T>(value: T): React.MutableRefObject<T> {
const ref = useRef(value);
useEffect(() => {
ref.current = value;
}, [value]);
return ref;
}
function useByrefCallback<Args extends unknown[], Result>(
callback: (...args: Args) => Result,
@lelegard
lelegard / purging-old-artifacts-with-github-api.md
Last active February 18, 2025 11:57
Purging old artifacts with GitHub Actions API

With GitHub Actions, a workflow can publish artifacts, typically logs or binaries. As of early 2020, the life time of an artifact is hard-coded to 90 days (this may change in the future). After 90 days, an artifact is automatically deleted. But, in the meantime, artifacts for a repository may accumulate and generate mega-bytes or even giga-bytes of data files.

It is unclear if there is a size limit for the total accumulated size of artifacts for a public repository. But GitHub cannot reasonably let multi-giga-bytes of artifacts data accumulate without doing anything. So, if your workflows regularly produce large artifacts (such as "nightly build" procedures for instance), it is wise to cleanup and delete older artifacts without waiting for the 90 days limit.

Using the Web page for the "Actions" of a repository, it is possible to browse old workflow runs and manually delete artifacts. But the procedure is slow and tedious. It is fine to delete one selected artifact. It is not for a regular cleanup. We need

public class ResponseImageId
{
public string id { get; set; }
}
@FruitieX
FruitieX / gist:28500ee32e00a5687c7f5031fb5b9922
Created November 13, 2018 16:19
Install Nix and direnv on WSL
sudo mkdir /etc/nix
echo "use-sqlite-wal = false" | sudo tee -a /etc/nix/nix.conf
curl https://nixos.org/nix/install | sh
source ~/.profile
nix-env -iA direnv
echo "eval \"\$(direnv hook bash)\"" >> ~/.profile
source ~/.profile
@stefanbuck
stefanbuck / upload-github-release-asset.sh
Last active August 27, 2024 08:46
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner