Skip to content

Instantly share code, notes, and snippets.

@svewag
svewag / check.sh
Last active April 14, 2019 20:29
reinstall node-modules after package-lock.json or .nvmrc has changed
#!/usr/bin/env bash
files=("package-lock.json" ".nvmrc")
for file in "${files[@]}"; do
# The HEAD@{1} is a special notation for the commit that HEAD used to be
# at prior to the original reset commit (1 change ago)
# See more: https://git-scm.com/docs/git-reflog
if [[ $(git diff HEAD@{1}..HEAD@{0} -- "${file}" | wc -l) -gt 0 ]]; then
echo
@svewag
svewag / express-brotli-content-type-thing
Last active April 26, 2019 06:06
after changing the req.url we have to set the Content-Type Header manually, otherwise it is set to application/octet-stream
const express = require('express')
const mime = require('mime')
const fs = require('fs')
const server = express()
server.get(/\.(js|css)$/, (req, res, next) => {
if (req.header('Accept-Encoding').includes('br')) {
if (fs.existsSync(`${config.path}${req.url}.br`)) {
const type = mime.lookup(req.path)
@svewag
svewag / inadyn.conf
Created September 11, 2020 09:17
working configuration file for your dyndns setting in ubiquiti dream machine e.g.
#
# Generated automatically by ubios-udapi-server
#
iface = ppp0
provider spdyn.de {
hostname = "your-hostname"
username = "your-email" # the same as your web login
password = "your-password" # the same as your web login, no update-token
checkip-server = "checkip.spdyn.de"
checkip-path = "/"
@svewag
svewag / gist:0b26212a56601dcd8afd71adb23d07ff
Created September 4, 2023 18:03
Awtrix Automation HA
alias: Awtrix Uhr
description: ""
trigger:
- platform: time_pattern
minutes: /1
condition: []
action:
- if:
- condition: numeric_state
entity_id: sensor.tesla_battery
@svewag
svewag / spotify.txt
Last active October 8, 2023 18:23
Spotify Video Adguard Block List
||video-ak.cdn.spotify.com.splitter-eip.akadns.net^