Skip to content

Instantly share code, notes, and snippets.

View beaulac's full-sized avatar

antoine beauᵛᵃᴵˢ⁻lacᵃˢˢᵉ beaulac

View GitHub Profile
@beaulac
beaulac / nyt-spelling-bee-qol.user.js
Last active July 7, 2021 01:52
NYT Spelling Bee QOL UserScript
// ==UserScript==
// @name NYT Spelling Bee QOL
// @namespace http://tampermonkey.net/
// @source https://gist.github.com/beaulac/6611fc1f0a7a88e0481fb103998a4eee
// @version 0.2
// @description Small NYTimes spelling bee improvements; rough WIP
// @author github.com/beaulac
// @match https://www.nytimes.com/puzzles/spelling-bee
// @icon https://www.google.com/s2/favicons?domain=nytimes.com
// @grant none
@beaulac
beaulac / sourcemaps.sh
Created May 6, 2020 22:59
Upload sourcemaps to Raygun from Netlify
#!/usr/bin/env bash
set -euo pipefail;
##
# NETLIFY VARS
# (https://docs.netlify.com/configure-builds/environment-variables/#read-only-variables)
##
PUBLIC_URL="${URL}";
if [[ -z "${PUBLIC_URL}" ]]; then
@beaulac
beaulac / babel-sparse-checkout
Created November 27, 2019 18:33
Sparse checkout configuration for building a single babel plugin
/*
!/packages/*
/packages/babel-core
/packages/babel-standalone
/packages/babel-preset-env-standalone
/packages/babel-parser
/packages/babel-types
/packages/babel-polyfill
/packages/babel-plugin-transform-runtime
@beaulac
beaulac / findLocalRaspis.sh
Created June 3, 2019 20:47
Get IPs of all RaspberryPis on an IP range
#!/usr/bin/env bash
set -euo pipefail;
IP_RANGE=${1-};
if [[ -z "${IP_RANGE}" ]]; then
echo "Must specify network range to scan, e.g. 192.168.2.0/24";
exit 1;
fi
@beaulac
beaulac / openproject-setup.sh
Created March 18, 2019 18:54
Openproject Setup on Ubuntu 18.04
#!/usr/bin/env bash
# SAFEMODE
set -euxo pipefail;
##
# Instructions from: https://www.openproject.org/download-and-installation/
##
# 1. Import the packager.io repository signing key
wget -qO- https://dl.packager.io/srv/opf/openproject-ce/key | sudo apt-key add -
@beaulac
beaulac / flatten_dir_to_links.sh
Last active March 3, 2023 18:38
Flatten all files in a directory (recursive) as symlinks in a target directory
@beaulac
beaulac / coloreplace.sh
Last active September 27, 2018 14:26
Replace fuzzy single color in sRGB transparent PNG
#!/usr/bin/env bash
FILE=$(realpath ${1});
OLD=$2;
NEW=$3;
# Default fuzz: 25%
FUZZ=${4:-25};
@beaulac
beaulac / check_rewritemap_duplicates.js
Created September 10, 2018 18:11
Check IIS rewrite map duplicates
'use strict';
const fs = require('fs');
const readline = require('readline');
const [, , filename] = process.argv;
if (!filename) {
throw Error('NO FILENAME SPECIFIED');
}
@beaulac
beaulac / build_IIS_rewriteMap.js
Last active September 10, 2018 17:23
Make IIS rewrite map from csv file.
'use strict';
const fs = require('fs');
const readline = require('readline');
const [, , filename] = process.argv;
if (!filename) {
throw Error('NO FILENAME SPECIFIED');
}
@beaulac
beaulac / amazon_to_shopify.js
Last active July 7, 2018 19:17
Turn Amazon reviews to shopify review CSV format
(function () {
const headerRow = 'product_handle,state,rating,title,author,email,location,body,reply,created_at,replied_at';
const escapeQuotes = s => s.replace('"', '\\"');
const fillTemplate = ({ rating, title, author, body, created_at }) => `zenstone-professional-rapid-stone-warmer,published,${rating},"${escapeQuotes(
title)}","${escapeQuotes(author)}",amzcust@amz.com,,"${escapeQuotes(body)}",,"${escapeQuotes(created_at)}",`;
function parseReview(review) {
const ratingContainer = review.querySelector('[data-hook="review-star-rating"]');
const starClass = Array.from(ratingContainer.classList).find(cls => cls.match(/a-star-(\d)/));