Skip to content

Instantly share code, notes, and snippets.

View YourFriendCaspian's full-sized avatar
🙃
I'm sure I'll be slow to respond so don't be mad.

yourfriendcaspian YourFriendCaspian

🙃
I'm sure I'll be slow to respond so don't be mad.
View GitHub Profile
@papes1ns
papes1ns / dexec.sh
Created May 17, 2023 02:15
dexec.sh
#!/usr/bin/env bash
set -eu # do not proceed on error
if [ $# -lt 1 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
cat <<EOF
Quick command to get a shell inside a running docker container.
Usage: dexec [container_name] [command]
@j1n6
j1n6 / noop_sync.vbs
Last active August 29, 2022 09:37
Powershell to sync and push to remote git repository via Windows Scheduled Tasks
' Hack to workaround the Powershell Console popup running on a Windows Scheduled Task
' Powershell limitations: https://github.com/PowerShell/PowerShell/issues/3028
'
' Add this file in the same git root directory as the sync.ps1
'
Dim shell,command
Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim sScriptDir : sScriptDir = oFSO.GetParentFolderName(WScript.ScriptFullName)
command = "powershell.exe -nologo -File " & sScriptDir & "\sync.ps1"
@zsarnett
zsarnett / lovelace.yaml
Created April 24, 2020 16:58
Lovelace YAML
########### Main Dashboard ###############
- badges: []
cards:
- cards:
- content: |
{% if now().month in (1,) %}
## January {{ now().day -}} ,
{% elif now().month in (2,) %}
## February {{ now().day -}},
{% elif now().month in (3,) %}
@fabifrank
fabifrank / remove-git-submodule
Last active February 14, 2021 16:35
Removing a git submodule is a mess... some bash script to ease the process and to make sure there's nothing left unsaved before removing.
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Missing submodule"
exit 1
fi
sn=$1
# verify that the folder is not deleted while there are unsaved changes
@dale3h
dale3h / configuration.yaml
Created September 1, 2018 00:49
[Home Assistant] If/Then Script
http:
...
trusted_networks:
- 127.0.0.1
rest_command:
ha_rest_api:
url: "http://localhost:8123/api/services/{{ service|replace('.', '/') }}"
method: post
content_type: application/json
@omiq
omiq / scan-network.py
Created August 28, 2018 21:26
Scan your local network for the host, IP and mac address, and detect Raspberry Pi
import sys
import nmap
import time
nm = nmap.PortScanner()
nm.scan('10.0.1.0/24', '22')
# clear screen
sys.stdout.write(u"\u001b[2J\u001b[0;0H")
sys.stdout.flush()
time.sleep(0.2)
@ciotlosm
ciotlosm / Readme.md
Last active February 5, 2024 15:04
Kiosk mode for lovelace

Kiosk mode

Installation

Add kiosk.js file with the content below to your www folder in config.

Like any other custom script, use ui-lovelace.yaml resources section to reference the kiosk.js file.

Make sure you add kiosk somewhere in your URL. You can use it in the id of your view or in the query string.

@OttoWinter
OttoWinter / 0migrator.md
Last active May 19, 2019 04:21
Lovelace Migration Script

Home Assistant Lovelace Migrator

Do you want to try out this experimental (!) new lovelace UI stuff in Home Assistant but don't want to migrate your entire configuration? This script is here to help! It reads in your Home Assistant configuration (specifically the group: section) and creates a matching ui-lovelace.yaml file in your Home Assistant configuration folder (of course backing up any previous file at that path).

To use this script, you first need to have python and home assistant installed where you plan to run this script. Do so using virtual environments and the pip3 install -U homeassistant command. Then copy below file to lovelace_migrate.py (any location should work) and run:

python3 lovelace_migrate.py -c <PATH_TO_HASS_CONFIG_DIR>
@srli
srli / stt_py3.py
Created June 25, 2018 14:47
Speech to text with PocketSphinx for Python3
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
import os
import pyaudio
import wave
import audioop
from collections import deque
import time
import math
@stewartadam
stewartadam / 00-docker-linuxserver-README.md
Last active October 11, 2022 17:13
systemd configuration for containers on boot with docker-compose (via linuxserver.io, among others)

Overview

This sample is intended for modern Linux systems using systemd (Fedora, Ubuntu, Arch, etc).

Installation

Install the files in this gist, replacing dashes for slashes (e.g. etc-systemd-system-dockercompose.service should be installed to /etc/systemd/system/dockercompose.service) and then run systemctl enable --now dockercompose.service to get things started.

Usage

Any manual docker-compose commands should be run from /srv/appdata/linuxserver so that the values from the .env file are applied properly.

Log files can be viewed by running docker-compose -f --tail=50.