Skip to content

Instantly share code, notes, and snippets.

View spinogrizz's full-sized avatar

Denis Gryzlov spinogrizz

  • Software Product
View GitHub Profile
@spinogrizz
spinogrizz / altesla-rest-api-hass.yaml
Created May 9, 2023 11:08
This is a HA integration to altesla.app API, so you could retrieve a Tesla car metrics and show them inside your dashboard
rest:
- authentication: basic
scan_interval: 45
resource: https://api.altesla.app/metrics
username: !secret altesla_vincode
password: !secret altesla_hashed_password
sensor:
- name: Tesla Model 3
unique_id: 359a56b7b3f0
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js" integrity="sha512-CNgIRecGo7nphbeZ04Sc13ka07paqdeTu0WR1IM4kNcpmBAUSHSQX0FslNhTDadL4O5SAGapGt4FodqL8My0mA==" crossorigin="anonymous" referrerpolicy="no-referrer">
</script>
<script>
function render_qr() {
let container = document.getElementById("qrcode");
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
@spinogrizz
spinogrizz / UIViewHierarchy.h
Last active December 22, 2015 08:59
Two common used methods to find a subview of any given (private) class inside some view hierarchy, or just dump all views in a pretty-print format using NSLog.
//
// UIViewHierarchy.h
//
// Created by Denis Gryzlov on 09.08.13.
// Copyright (c) 2013 Armada. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (Hierarchy)
@spinogrizz
spinogrizz / gist:4096090
Created November 17, 2012 13:47
Blink LED on every UDP packet
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 0, 177);
unsigned int localPort = 8888;
char packetBuffer[UDP_TX_PACKET_MAX_SIZE];
@spinogrizz
spinogrizz / UIImage+Trim.m
Created August 31, 2012 07:37
Trim transparent pixels around UIImage
- (UIImage *) imageByTrimmingTransparentPixels {
int rows = self.size.height;
int cols = self.size.width;
int bytesPerRow = cols*sizeof(uint8_t);
if ( rows < 2 || cols < 2 ) {
return self;
}
//allocate array to hold alpha channel