Skip to content

Instantly share code, notes, and snippets.

View inverse's full-sized avatar

Malachi Soord inverse

View GitHub Profile
#!/usr/bin/env bash
set -euf -o pipefail
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
echo "Not in a git repository"
exit 1
fi
TEMPLATE_PATH="$(git rev-parse --show-toplevel)/.git/template"
#!/usr/bin/env bash
set -uf -o pipefail
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
echo "Not in a git repository"
exit 1
fi
TEMPLATE_PATH="$(git rev-parse --show-toplevel)/.git/template"
# Turn on the living room lamp every day 10 minutes before sunset.
- alias: "Living Room - Sunset"
trigger:
- platform: sun
event: sunset
offset: "-00:10:00"
action:
- service: yeelight.set_color_scene
data:
entity_id: light.xiaomi_yeelight_rgbw
@inverse
inverse / update.sh
Created August 26, 2020 18:15
Psalm updater
#!/bin/bash
PACKAGE=psalm
REPO=vimeo/$PACKAGE
if [ "$#" -ne 1 ]
then
echo "Trying ro resolve latest..."
VERSION=$(curl --silent "https://api.github.com/repos/${REPO}/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
@inverse
inverse / prepare-commit-msg
Last active July 9, 2020 06:48
Git hook for adding branch name to commit message if it conforms to ticket naming convention
#!/bin/bash
# Prepend branch name to commit message in [] if matching regex. e.g. DEN-123
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
BRANCH_IN_COMMIT=$(grep -c "\[$BRANCH_NAME\]" $1)
if [ -n "$BRANCH_NAME" ] && [[ $BRANCH_NAME =~ ^([A-Z]+-[0-9]+)(\-.+)?$ ]] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then
- name: PHP | Install ondrej PPA
apt_repository:
repo: 'ppa:ondrej/php'
state: present
tags: php
- name: PHP | Install packages
apt:
name: '{{ item }}'
state: latest
@inverse
inverse / update.sh
Last active October 9, 2018 19:04
Update espurna
#!/bin/bash
declare -a devices=(
""
)
USER=""
PASS=""
# Environment you're deploying
@inverse
inverse / scraping.js
Last active April 25, 2018 19:37
scraping
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({args: ['--no-sandbox'], headless: true});
const page = await browser.newPage();
await page.goto('https://www.bibiblocksberg.de/hoerspiele');
const loadMoreSelector = '.pager__item a';
for(i = 0; i < 6; i++) {
@inverse
inverse / photoProcess.sh
Last active March 11, 2018 20:04
Process Photos
#!/bin/bash
# Dependencies
#
# - exiftool (http://www.sno.phy.queensu.ca/~phil/exiftool/)
# - sortphotos (https://github.com/andrewning/sortphotos)
#
if ! [ -x "$(command -v exiftool)" ]; then
echo 'Error: exiftool is not installed.' >&2
@inverse
inverse / lastfmextra.user.js
Last active February 10, 2016 06:02
Last.fm Extra
// ==UserScript==
// @name Last.fm Extra
// @namespace https://malachisoord.com/
// @version 0.1.3
// @description Provide missing extra functionality to Last.fm
// @author Malachi Soord
// @match http://www.last.fm/*
// @require https://code.jquery.com/jquery-2.2.0.min.js
// @run-at document-idle
// ==/UserScript==