Skip to content

Instantly share code, notes, and snippets.

View MrSquaare's full-sized avatar
🛰️
Exploring

Guillaume Bonnet MrSquaare

🛰️
Exploring
View GitHub Profile
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}