Skip to content

Instantly share code, notes, and snippets.

View rosterloh's full-sized avatar

Richard Osterloh rosterloh

View GitHub Profile
@jfierstein
jfierstein / check_mail.py
Created April 22, 2019 05:01
Python script for scraping Gmail inbox for Amazon package emails with today as delivery date (written for Home Assistant)
import sys, smtplib, time
import datetime
import imaplib
import email
import json
EMAIL = "<YOURADDRESS>@gmail.com"
PWD = "<YOURSECRETPASSWORD>"
SMTP_SERVER = "imap.gmail.com"
SMTP_PORT = 993
@mcfrojd
mcfrojd / Shield_Intents.MD
Last active March 30, 2024 16:53
Working INTENTS to use with Community Hass.io Add-ons: Android Debug Bridge for your Nvidia Shield TV

Latest Update 2021-03-06 : New image showing the new "Services" in Home Assistant and got some tips from the comments below.

Credits and thanks: Home Assistant Forum users & Github users: @ocso, @wiphye, @teachingbirds, @tboyce1, @simbesh, @JeffLIrion @ff12 @rebmemer @siaox @DiederikvandenB @Thebuz @clapbr @Finsterclown


Start apps on your android device (in the examples below, my Nvidia Shield TV) from Home Assistant

alt text

Starts Youtube App

entity_id: media_player.shield
command: >-
@rsnk96
rsnk96 / multiprocessing_cv.py
Last active September 9, 2020 08:36
Outline of a parallelized video processing code
def process_video(group_number):
cap = cv2.VideoCapture("input_file.mp4")
cap.set(cv2.CAP_PROP_POS_FRAMES, frame_jump * group_number)
proc_frames = 0
out = cv2.VideoWriter("output_{}.avi".format(group_number), ...)
while proc_frames < frame_jump:
ret, frame = cap.read()
# ... DO SOME STUFF TO frame ... #
proc_frames += 1
out.write(frame)
@willprice
willprice / README.md
Last active February 8, 2023 21:27
Install OpenCV 4.1.2 for Raspberry Pi 3 or 4 (Raspbian Buster)

Install OpenCV 4.1.2 on Raspbian Buster

$ chmod +x *.sh
$ ./download-opencv.sh
$ ./install-deps.sh
$ ./build-opencv.sh
$ cd ~/opencv/opencv-4.1.2/build
$ sudo make install
@ValCanBuild
ValCanBuild / BottomNavigationBehavior.kt
Last active December 18, 2023 00:04
Full code of a BottomNavigationBehavior which hides itself on scroll and handles Snackbars, FAB and snapping. https://medium.com/@ValCanBuild/scroll-your-bottom-navigation-view-away-with-10-lines-of-code-346f1ed40e9e
/**
MIT License
Copyright (c) 2018 Valentin Hinov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@alex-spataru
alex-spataru / A QML Material Drawer.md
Last active August 20, 2023 07:12
Implementation of a simple and clean Material drawer for your QtQuick/QML applications

Description

This gist allows you to implement a material drawer easily for your projects. It consists of three files:

  • PageDrawer.qml The drawer itself, with an icon viewer, a list view and some hacks to execute the actions/functions assigned to each drawer item
  • DrawerItem.qml Which can act as an action, a spacer, a separator or a link
  • SvgImage.qml Ugly hack to make SVG images look crisp and smooth on HDPI screens

Licence

This code is released under the WTFPL, for more information click here.

@ric96
ric96 / main.c
Created December 3, 2017 17:00
hcsr04 sample code for zephyr on 96b_carbon
#include <zephyr.h>
#include <misc/printk.h>
#include <device.h>
#include <gpio.h>
#include <sys_clock.h>
#include <misc/util.h>
#include <limits.h>
#define GPIO_OUT_PIN 1
#define GPIO_INT_PIN 3
@onetransistor
onetransistor / pulseview.sh
Last active March 20, 2024 14:39
Script to compile and install PulseView on Ubuntu Linux
#!/bin/bash
# Script that will download, compile and install PulseView and its dependencies
# For more information visit:
# https://www.onetransistor.eu/2017/11/script-to-compile-and-install-pulseview.html
set -e
echo "PulseView: Download, build and install"
echo "Installing dependencies"
@florina-muntenescu
florina-muntenescu / Data.kt
Last active April 16, 2024 19:48
Using RoomDatabase#Callback to pre-populate the database - https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@AkshayChordiya
AkshayChordiya / FileLiveData.kt
Last active November 16, 2023 23:42
FileLiveData to observe changes to file
class FileLiveData(private val context: Context) : LiveData<List<String>>() {
private val fileObserver: FileObserver
init {
val path = File(context.filesDir, "users.txt").path
fileObserver = object : FileObserver(path) {
override fun onEvent(event: Int, path: String?) {
// The file has changed, so let’s reload the data
loadData()
}