Skip to content

Instantly share code, notes, and snippets.

@esbenr
esbenr / gist:8a8c5a5def754d123da71d6df6a58934
Created April 2, 2020 14:59
Lovelace card for displaying renovation sensors in Home Assistant
entities:
- entity: sensor.renovation_restaffald_formatted
name: Restaffald
icon: mdi:trash-can
- entity: sensor.renovation_emballage_formatted
name: Emballage
icon: mdi:recycle
- entity: sensor.renovation_pappapir_formatted
name: Pap og papir
icon: mdi:newspaper
@esbenr
esbenr / gist:c1b0970548a2431ab75be24ea82c20e0
Created April 2, 2020 14:53
Utilizing Renosyds API to integrate garbage collection into Home Assistant
sensor:
- platform: rest
resource: http://skanderborg.netdialog.renosyd.dk/service/Restservice.svc/json/commonapp1/address/123964/containers
username: !secret renosyd_username
password: !secret renosyd_password
authentication: basic
headers:
Content-Type: application/json
scan_interval: 360
json_attributes:
@nimahkh
nimahkh / addSRT2MKV.sh
Last active October 26, 2023 22:40
add srt subtitle into mkv video with FFMPEG- put all off your mkv and srt files with same names ina folder and run sh command. all of the converted files will be in the added folder inside the current folder.
#!/bin/bash
#author: nima.2004hkh@gmail.com
#ffmpeg command from : https://gist.github.com/kurlov/32cbe841ea9d2b299e15297e54ae8971
NOCOLOR='\033[0m';
RED='\033[0;31m';
GREEN='\033[0;32m';
[ -d added ] || mkdir added
@vielhuber
vielhuber / script.sh
Last active April 28, 2024 06:38
PostgreSQL: Backup and restore export import pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux
Rem run as administrator
@echo on & @setlocal enableextensions
@echo =========================
@echo Turn off the time service
net stop w32time
@echo ======================================================================
@echo Set the SNTP (Simple Network Time Protocol) source for the time server
w32tm /config /syncfromflags:manual /manualpeerlist:"0.it.pool.ntp.org 1.it.pool.ntp.org 2.it.pool.ntp.org 3.it.pool.ntp.org"
@echo =============================================
@echo ... and then turn on the time service back on

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@sebastianbarfort
sebastianbarfort / KV2013
Last active December 7, 2021 07:15
Download kommunalvalgsdata fra kmdvalg.dk.
library(XML)
# main page
url <- "http://kmdvalg.dk/main"
# read links
url.data <- readLines(url)
doc <- htmlTreeParse(url.data, useInternalNodes = TRUE)
#grab urls
urls <- unlist(xpathApply(doc, "//div[@class='LetterGroup']//a[@href]",
@jc3wmdev
jc3wmdev / gist:4593725
Last active December 7, 2021 11:19
exiftool - list 5 star rated photos
exiftool -if '$Rating eq 5' *.JPG -q -p '$FileName'