Skip to content

Instantly share code, notes, and snippets.

View MrSquaare's full-sized avatar
🛰️
Exploring

Guillaume Bonnet MrSquaare

🛰️
Exploring
View GitHub Profile
@MrSquaare
MrSquaare / restore_supabase_database.sh
Created March 18, 2026 09:23
Restore Supabase database in one line
# 1. Download your previous project database backup
# 2. Create a new project
# 3. Click on "Connect" > "Direct" > Select "Session pooler" > Copy the connection string and replace the [YOUR-PASSWORD] with your database password
# 4. Run the following command inside the directory where your backup file is
# With Docker (portable, no install)
CONNECTION_STRING="<Your connection string>" \
FILE_NAME="<Your .gz backup file name>" && \
docker run --rm \
-e CONNECTION_STRING="$CONNECTION_STRING" \
@MrSquaare
MrSquaare / remove_git_lfs_from_github_codespace.sh
Created February 3, 2026 15:47
Remove Git LFS from GitHub Codespace
git config --local --remove-section lfs
rm -rf .git/hooks
FROM alpine:3 AS base
ENV WORK_DIRECTORY="/usr/docker/context"
WORKDIR ${WORK_DIRECTORY}
COPY . .
CMD ["sh"]
@MrSquaare
MrSquaare / github-labels-import.js
Created October 28, 2020 17:27
Import all labels to a GitHub repository
let input = prompt("JSON labels:")
let labels = JSON.parse(input)
let newLabelForm = document.querySelector("form#new_label")
let newLabelNameInput = document.querySelector("input#label-name-")
let newLabelDescriptionInput = document.querySelector("input#label-description-")
let newLabelColorInput = document.querySelector("input#label-color-")
let newLabelSubmitButton = newLabelForm.querySelector(`button[type="submit"]`)
labels.forEach(label => {
@MrSquaare
MrSquaare / github-labels-export.js
Last active December 1, 2021 10:52
Export all labels of a GitHub repository
let labels = []
let selector = `a.js-label-link`
function getRGBFromElement(element) {
const red = element.attributeStyleMap.get('--label-r')[0]
const green = element.attributeStyleMap.get('--label-g')[0]
const blue = element.attributeStyleMap.get('--label-b')[0]
return `rgb(${red}, ${blue}, ${green})`
}
@MrSquaare
MrSquaare / github-labels-delete.js
Created October 28, 2020 17:26
Delete all labels of a GitHub repository
let windowConfirm = window.confirm
let selector = `form.js-delete-label`
window.confirm = function () {
return true
}
document.querySelectorAll(selector).forEach(deleteForm => {
let submitButton = deleteForm.querySelector(`button[type="submit"]`)
@MrSquaare
MrSquaare / locale-debian.sh
Created August 9, 2019 14:16
Script to solve the locale problem on Debian-based systems
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
read -r -p "Enter the locale code [en_US.UTF-8]: " locale
locale=${locale:-en_US.UTF-8}