Skip to content

Instantly share code, notes, and snippets.

@sbyx
sbyx / notify-or-do-something-when-an-appliance-like-a-dishwasher-or-washing-machine-finishes.yaml
Last active November 13, 2024 12:51
Home Assistant Blueprint: Notify or do something when an appliance like a dishwasher or washing machine finishes
blueprint:
name: Appliance has finished
description: Do something when an appliance (like a washing machine or dishwasher)
has finished as detected by a power sensor.
domain: automation
input:
power_sensor:
name: Power Sensor
description: Power sensor entity (e.g. from a smart plug device).
selector:
@sam0737
sam0737 / clock.html
Last active April 25, 2024 12:24
OBS Studio: A HTML page for showing current date and time in the video
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>A simple clock</title>
</head>
<body translate="no" >
@enwi
enwi / fan_control.sh
Last active November 17, 2019 13:55
Little shell script that reads the temperature of a raspberry pi cpu and a connected harddrive using smartctl and controls a GPIO pin where a fan should be connected.
#!/bin/bash
c_FAN=26 # gpio pin the fan is connected to
c_MIN_TEMPERATURE=45 # temperature in degrees c when fan should turn on
c_TEMPERATURE_OFFSET=2 # temperarute offset in degrees c when fan should turn off
c_HARDDRIVE="sda" # name of your harddrive
temperature_offset=$(( $c_MIN_TEMPERATURE - $c_TEMPERATURE_OFFSET ))
fan_state=0
@maxgalbu
maxgalbu / backup.python2.py
Last active August 16, 2020 10:05
Updated API version + Python 2 version of https://stackoverflow.com/a/34469893/2265500
import os
import errno
from subprocess import call
from gitlab import Gitlab
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
@enwi
enwi / update.sh
Created August 6, 2017 13:39
Simple shell script that updates your linux. If you only want error messages then uncomment the comments in each line.
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[1;32m'
BLUE='\033[1;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}System update${NC}"
sudo apt-get update #2>&1 >/dev/null
echo -e "${BLUE}System upgrade${NC}"
sudo apt-get upgrade -y #2>&1 >/dev/null
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active November 15, 2024 12:45 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Exporting your 2FA tokens from Authy to transfer them into another 2FA application

IMPORTANT - Update regarding deprecation of Authy desktop apps

Past August 2024, Authy stopped supported the desktop version of their apps:
See Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August for details.

And indeed, after a while, Authy changed something in their backend which now prevents the old desktop app from logging in. If you are already logged in, then you are in luck, and you can follow the instructions below to export to tokens.

If you are not logged in anymore, but can find a backup of the necessary files, then restore those files, and re-install Authy 2.2.3 following the instructions below, and it should work as expected.

@exceptionplayer
exceptionplayer / sync-gitlab-projects
Last active March 24, 2023 02:42 — forked from JonasGroeger/sync-projects
Gitlab: Clone / Pull all projects in a group in gitlab(批量下载gitlab中的项目)
#!/usr/bin/env bash
# should install jq first, for mac:brew install jq
# Documentation
# https://docs.gitlab.com/ce/api/projects.html#list-projects
NAMESPACE="your group name in gitlab"
BASE_PATH="https://gitlab.example.com/"
PROJECT_SEARCH_PARAM=""
@nathanbrauer
nathanbrauer / sync-projects
Last active February 4, 2020 21:14 — forked from JonasGroeger/sync-projects
Gitlab: Clone / Pull all projects in a group
#!/usr/bin/env bash
# Documentation
# https://docs.gitlab.com/ce/api/projects.html#list-projects
if [[ `whoami` == "root" ]]; then
echo "DO NOT run this program as root! Quitting."
exit 1
fi
@onthedesk
onthedesk / sync-projects
Last active July 1, 2018 02:40 — forked from JonasGroeger/sync-projects
Gitlab: Clone / Pull all projects in a group
#!/usr/bin/env bash
# Documentation
# https://docs.gitlab.com/ce/api/projects.html#list-projects
# NAMESPACE="YOUR_NAMESPACE"
BASE_PATH="YOUR_GIT_SERVER_PATH"
# PROJECT_SEARCH_PARAM="YOUR_SEARCH_PARAM"
if [ -z "$GITLAB_PRIVATE_TOKEN" ]; then
@JonasGroeger
JonasGroeger / sync-projects
Last active May 15, 2024 01:44
Gitlab: Clone / Pull all projects in a group
#!/usr/bin/env bash
# Documentation
# https://docs.gitlab.com/ce/api/projects.html#list-projects
NAMESPACE="YOUR_NAMESPACE"
BASE_PATH="https://gitlab.example.com/"
PROJECT_SEARCH_PARAM=""
PROJECT_SELECTION="select(.namespace.name == \"$NAMESPACE\")"
PROJECT_PROJECTION="{ "path": .path, "git": .ssh_url_to_repo }"