Skip to content

Instantly share code, notes, and snippets.

View mutovkin's full-sized avatar
😁

Serguei Moutovkin mutovkin

😁
  • Flight Centre Travel Group
  • Irvine, California
View GitHub Profile
@mutovkin
mutovkin / presence-sensor-light-automation.yaml
Created May 2, 2024 02:59
My version of a presence sensor script
blueprint:
name: Presence-activated Light
description: Turn on a light when presence is detected.
homeassistant:
min_version: 2023.8.0
domain: automation
source_url: https://gist.github.com/mutovkin/5845bd35b82970ce4c0b91aca7166906
input:
presence_entity:
name: Presence Sensor
@mutovkin
mutovkin / import_csv_to_sqlite.sh
Created April 29, 2024 19:35
Converts CSV file into a table in SQLite Database
#!/usr/bin/env bash
# This script accepts 3 parameters:
# 1. CSV file to import (should have first row as a header and names should not contain dashes, all lower case)
# 2. Database filename where the csv file will be imported (filename should have .db extension)
# 3. Table name where the csv file will be imported (table name should not contain dashes, all lower case)
CSV_FILE=$1
DB_FILE=$2
@mutovkin
mutovkin / sqlite_query_to_csv.sh
Created April 29, 2024 19:33
Run query on top of SQLite database and output results to CSV
#!/usr/bin/env bash
# Script accepts 3 parameters
# 1. Query string to execute (in quotes which are opposite of quotes used in the query)
# 2. Database filename where the query will be executed
# 3. Output filename where the query result will be saved
QUERY_STRING=$1
DB_FILE=$2
OUTPUT_FILE=$3
blueprint:
name: Occupancy
description: |
This blueprint is based on the Wasp in a box princible. It is inspired by the AppDaemon app that does the same thing.
You can find more information about this blueprint on the Home Assistant Community: https://community.home-assistant.io/t/occupancy-blueprint/477772
domain: automation
source_url: https://gist.github.com/mutovkin/79dde43bc5d6aa0c003a5afa3c414b40
input:
door_sensor:
name: Single Door Sensor or Door Sensor Group
blueprint:
name: Occupancy
description: |
This blueprint is based on the Wasp in a box princible. It is inspired by the AppDaemon app that does the same thing.
You can find more information about this blueprint on the Home Assistant Community: https://community.home-assistant.io/t/occupancy-blueprint/477772
domain: automation
source_url: https://gist.github.com/AlexanderBabel/487f054b289b61f90afdc837d23cb85e
input:
door_sensor:
@mutovkin
mutovkin / costcoemailbody.html
Created March 9, 2023 22:24
Costco Marketing Email
<!doctype html>
<html xmlns=3D"http://www.w3.org/1999/xhtml" lang=3D"en" xm=l:lang=3D"en"
xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:v==3D"urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv=3D"Content-Type=" content=3D" text/html; charset=3DUTF-8" />
<meta name=3D"x-apple-disable-m=essage-reformatting" />
<meta name=3D"viewport" content=3D"width=3Ddevice-w=idth, initial-scale=3D1.0" />
<meta http-equiv=3D"X-UA-Compatible" content==3D"IE=3Dedge" />
<title>NEW & EXCLUSIVE! Our Latest Member-Only Savings Bo=
@mutovkin
mutovkin / main.go
Created June 29, 2022 18:31
DynamoDB Time Formatting Example
package main
import (
"context"
"fmt"
"os"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
@mutovkin
mutovkin / PgEnumScalarType.java
Created November 15, 2019 07:54
Attempt to wrap enum.
public final class PgEnumScalarType<T extends Enum<T>> extends ScalarTypeBase<T> {
final String postgresType;
public T enumVal;
public PgEnumScalarType(final String postgresType, final T enumVal) {
super(enumVal.getDeclaringClass(), false, java.sql.Types.OTHER);
this.postgresType = postgresType;
this.enumVal = enumVal;
}