Skip to content

Instantly share code, notes, and snippets.

@SebFlippence
SebFlippence / git-update-all-emails.sh
Created Jan 30, 2021
Update all old email addresses in commits from all existing GitHub repos
View git-update-all-emails.sh
# Requires `git filter-repo` https://github.com/newren/git-filter-repo
mkdir tmp && cd tmp
export USERNAME="github-username"
export TOKEN="github-token-with-repo-access"
curl -u "$USERNAME:$TOKEN" "https://api.github.com/search/repositories?q=user:$USERNAME" |
grep -e 'ssh_url*' |
cut -d \" -f 4 |
@SebFlippence
SebFlippence / Dockerfile
Last active Dec 28, 2020 — forked from remarkablemark/Dockerfile
Install node and npm with nvm using Docker.
View Dockerfile
# set the base image to Debian
# https://hub.docker.com/_/debian/
FROM debian:latest
# use bash so we can source files
SHELL ["/bin/bash", "-c"]
# update the repository sources list
# and install dependencies
RUN apt-get update \
@SebFlippence
SebFlippence / README.md
Last active Jul 16, 2020
Quickly and easily deploy an Eleventy Static Site to GitHub Pages with a custom domain
View README.md

Deploying an Eleventy Static Site to GitHub Pages with a custom domain

Quickly and easily deploy an Eleventy Static Site to GitHub Pages with an optional custom domain.

Setup

  1. Use or create a new Eleventy project and commit and push it to a GitHub repo.
  2. In the root folder of your Eleventy project create a new file deploy.sh and copy the contents into it and on the commandline run chmod +x deploy.sh
  3. Edit your package.json file adding "deploy": "./deploy.sh" into the bottom of the scripts: section.
@SebFlippence
SebFlippence / Dockerfile
Last active Jul 13, 2019
Docker Android build container
View Dockerfile
FROM openjdk:8-jdk-slim-stretch
SHELL ["/bin/bash", "-c"]
# Install build tools & newer version of cmake from Debian backports
RUN echo "deb http://deb.debian.org/debian stretch-backports main contrib non-free" >> /etc/apt/sources.list.d/backports.list \
&& apt-get update \
&& apt-get install -y \
build-essential \
bzip2 \
@SebFlippence
SebFlippence / autostart
Last active Oct 22, 2019
Auto start Raspberry Pi Chromium fullscreen from a list of bookmarks
View autostart
# /home/pi/.config/lxsession/LXDE-pi/autostart
@bash /home/pi/chromium-monitoring.sh
@SebFlippence
SebFlippence / .gitignore
Last active Sep 29, 2020
Concourse CI with a Windows worker
@SebFlippence
SebFlippence / raspberry-pi-cec-client.md
Created May 13, 2019
Using cec-client on a Raspberry Pi to control TV power and inputs via HDMI
View raspberry-pi-cec-client.md

Using cec-client on a Raspberry Pi

Most modern HDMI connected devices support Consumer Electronics Control (CEC). It allows devices to send commands to each other, typically to get the TV to switch input and control volume. If you have ever turned on a Game Console and had your TV automatically change input to that device you have seen CEC in action. It is very convenient and useful, sort of a universal remote that works.

Every manufacturer seems to have it’s own branding of CEC (e.g. Samsung Anynet+, LG SimpLink, Sharp Aquos Link) but it may need to be enabled. Check your manual for details.

Using a Raspberry Pi connected to a TV that supports CEC, you can use the command line cec-client application to control the inputs and the TV itself. These are notes on how to use cec-client and understand the different options.

Details

@SebFlippence
SebFlippence / sort-package-json.sh
Created Dec 4, 2018
Sorts dependencies in all `package.json` files in the current directory
View sort-package-json.sh
# yarn global add npm-sort
# find . ! -path "*node_modules*" -type f -name "package.json" -exec `pwd`/sort-package-json.sh "{}" \;
pushd `dirname $1` && npm-sort && sed -i '' -e '$a\' package.json && popd
@SebFlippence
SebFlippence / index.js
Last active Mar 25, 2020
Log all incoming HTTP and HTTPS requests
View index.js
const fs = require('fs');
const https = require('https');
const Koa = require('koa');
const multipartBodyParser = require('koa-body');
const app = new Koa();
app.use(
multipartBodyParser({
@SebFlippence
SebFlippence / index.js
Created Aug 1, 2017
Node Chrome Headless wait until element exists
View index.js
const chromeLauncher = require('chrome-launcher');
const CDP = require('chrome-remote-interface');
const sleep = require('sleep-async');
// Optional: set logging level of launcher to see its output.
// Install it using: yarn add lighthouse-logger
// const log = require('lighthouse-logger');
// log.setLevel('info');
/**