Skip to content

Instantly share code, notes, and snippets.

@maksim-tolo
maksim-tolo / hassos-rpi-camera-howto.md
Created June 21, 2022 12:49 — forked from enegaard/hassos-rpi-camera-howto.md
Getting the Raspberry Pi Camera to Work on HASSOS

Getting the Raspberry Pi Camera to Work on HASSOS

Enabling the Raspberry Pi camera on HASSOS installations is unfortunately not as simple as connecting the camera and configuring Home Assistant as described at https://www.home-assistant.io/integrations/rpi_camera.

For the camera to work at all, an alternate firmware needs to be loaded when the Raspberry Pi boots. On Raspberry Pi OS (and many others), the alternate firmware is included with the OS installation image, and switching to the alternate firmware is accomplished by running raspi-config and selecting "Enable Camera" from the menu. HASSOS does not include either the alternate firmware or the raspi-config program, so all of the steps need to be done manually.

The steps below attempt to describe the steps that need to be performed. They have worked for me on a Raspberry Pi 3B+ running HASSOS 4.11 through 4.15. If you have a different setup your mileage may vary (but hopefully you'll get enough hints from the below to get it working).

As of HASSOS 6

@maksim-tolo
maksim-tolo / yandex_station_status.yaml
Created September 14, 2020 08:20 — forked from AlexxIT/yandex_station_status.yaml
Отображаем статус Яндекс Станции с помощью умных ламп
yandex_station:
username: myuser
password: mypass
sensor:
- platform: template
sensors:
alice_state:
value_template: "{{ state_attr('media_player.yandex_station_mini', 'alice_state') }}"
@maksim-tolo
maksim-tolo / traceProperty.js
Created April 4, 2019 15:41 — forked from prashantpalikhe/traceProperty.js
Devtools snippet to trace property access
const traceProperty = (object, property) => {
let value = object[property];
Object.defineProperty(object, property, {
get () {
console.trace(`${property} requested`);
return value;
},
set (newValue) {
console.trace(`setting ${property} to `, newValue);
value = newValue;
pragma solidity 0.4.25;
contract Getter {
function getDragonGenome(uint256) external view returns (uint8[30]);
function getDragonTypes(uint256) external view returns (uint8[11]);
function getDragonTactics(uint256) external view returns (uint8, uint8);
function getDragonBattles(uint256) external view returns (uint16, uint16);
function getDragonSkills(uint256) external view returns (uint32, uint32, uint32, uint32, uint32);
function getDragonParents(uint256) external view returns (uint256[2]);
function getDragonSpecialAttack(uint256) external view returns (uint8, uint32, uint8, uint8);
@maksim-tolo
maksim-tolo / notify-user-of-update.js
Created May 11, 2018 12:18 — forked from luke-denton-aligent/notify-user-of-update.js
This snippet shows how to notify the user of a new version of the site (a new service worker version)
// Offline Web Applications course on Udacity https://classroom.udacity.com/courses/ud899
//This code is to be placed in a controller file, not in the service worker itself
IndexController.prototype._registerServiceWorker = function() {
if (!navigator.serviceWorker) return; //Feature detection
var indexController = this;
navigator.serviceWorker.register('/sw.js').then(function(reg) {
// If there's no controller, this page wasn't loaded via a service worker, so they're looking at the latest version.
@maksim-tolo
maksim-tolo / gist:478e73aab36fca6a1624aeb3bad5894f
Created May 3, 2018 15:52 — forked from borismus/gist:1032746
Convert a base64 string into a binary Uint8 Array
var BASE64_MARKER = ';base64,';
function convertDataURIToBinary(dataURI) {
var base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
var base64 = dataURI.substring(base64Index);
var raw = window.atob(base64);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));
for(i = 0; i < rawLength; i++) {

Keybase proof

I hereby claim:

  • I am maksim-tolo on github.
  • I am maxim_tolo (https://keybase.io/maxim_tolo) on keybase.
  • I have a public key ASD7-aKcaE0MSA6sRTLliT444dtYMeEt5P0a1ZgoaxuemQo

To claim this, I am signing this object:

@maksim-tolo
maksim-tolo / formatjs-examples.md
Last active August 31, 2023 13:36
Custom angular wrapper for format.js & react-intl PoC examples

Simple text

Angular

<h2
  translate="KIBANA-DISCOVER-SEARCHING"
  default-message="Searching"
></h2>

Simple text

Angular

<h2
  i18n="KIBANA-DISCOVER-SEARCHING"
  default-message="Searching"
></h2>