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 May 9, 2024 07:15
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
@medusar
medusar / 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 }"
@thegauraw
thegauraw / clone_gitlab_projects.rb
Last active May 28, 2020 20:14
How to clone all the repositories or projects from gitlab?
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
# TWO WAYS TO RUN THIS SCRIPT:
# ----------------------------
# --->>> THE FIRST WAY> Run this script as executable: `./clone_gitlab_projects.rb`
# You need to make the script executable: `chmod +x gitlab_clone_all_repos.rb`
# ---- ANYTHING ABOVE THIS LINE IS ONLY REQUIRED IF YOU WANT TO RUN THE SCRIPT WITH SINGLE COMMAND `./clone_gitlab_projects.rb` ---- #