Skip to content

Instantly share code, notes, and snippets.

View jseidl's full-sized avatar

Jan Seidl jseidl

View GitHub Profile
@jseidl
jseidl / lovelace_views_tesla.yaml
Created June 30, 2020 18:18
Home Assistant - Tesla Lovelace View
title: Car
icon: 'mdi:car'
path: car
cards:
- !include 'cards/tesla.yaml'
- type: map
aspect_ratio: 16:9
default_zoom: 13
entities:
- device_tracker.tesla_model_3_location_tracker
@jseidl
jseidl / tesla.yaml
Last active January 6, 2023 03:58
Home Assistant - Lovelace Tesla Card
type: picture-elements
image: !file /local/images/other/tesla.png
elements:
{% set sensors = [
('binary_sensor.tesla_model_3_online_sensor', False),
('binary_sensor.tesla_model_3_parking_brake_sensor', True),
('climate.tesla_model_3_hvac_climate_system', False),
('device_tracker.tesla_model_3_location_tracker', False),
('sensor.tesla_model_3_mileage_sensor', False)
]

Keybase proof

I hereby claim:

  • I am jseidl on github.

  • I am seidlmeister (https://keybase.io/seidlmeister) on keybase.

  • I have a public key ASAWNARMunt5JtZa3-cX1E11oI571jglDlAnMworEuMAiwo

@jseidl
jseidl / calc_sll1AddHash32.py
Created November 12, 2014 03:37
Calculates sll1AddHash32 hashes
#!/usr/bin/env python
"""
Calculate sll1AddHash32 hashes
based on pseudocode from https://github.com/mandiant/Reversing/blob/master/shellcode_hashes/make_sc_hash_db.py
@author Jan Seidl <jseidl@wroot.org>
"""
import sys
@jseidl
jseidl / ptail.py
Last active May 11, 2018 21:15
Simple persistent "tail -f" in pure python
#!/usr/bin/env python
import sys, sqlite3, time, os
FILENAME = sys.argv[1]
SINCEDB_NAME = '.sincedb'
conn = sqlite3.connect(SINCEDB_NAME)
c = conn.cursor()
@jseidl
jseidl / number_text_to_integer.py
Created April 10, 2014 14:00
Convert textual representation of numbers (twenty two) into integers (22)
def number_text_to_integer(self, text):
parts = text.split(' ')
accumulator = 0
oper = 'sum'
units = ['','one','two','three','four','five','six','seven','eight','nine']
teens = ['','eleven','twelve','thirteen','fourteen','fifteen','sixteen', 'seventeen','eighteen','nineteen']
tens = ['','ten','twenty','thirty','forty','fifty','sixty','seventy', 'eighty','ninety', 'hundred']
@jseidl
jseidl / unshorten.py
Created December 31, 2013 04:39
URL unshortener in python. Just following HTTP 3XX codes within HEAD requests. Based on http://stackoverflow.com/questions/7153096/how-can-i-un-shorten-a-url-using-python/7153185#7153185 fixed for HTTPS
import httplib
import urlparse
def unshorten_url(url):
parsed = urlparse.urlparse(url)
if parsed.scheme == 'https':
h = httplib.HTTPSConnection(parsed.netloc)
else:
@jseidl
jseidl / regex_spam_usernames
Created August 2, 2012 19:48
SPAM Usernames Regular Expression
([A-Z][a-z]+)+\d+
## Matches names like
# AaeeshaMcLaughlin3182
# AbarcaSchott193
# AbegayleDay2122
# AbejideDawnay2765
@jseidl
jseidl / wp_migration
Created August 2, 2012 17:01
Wordpress Migration
$old_site = 'http://example.com';
$new_site = 'http://newsite.com';
$wpdb_prefix = 'wp';
# Replace slugs
update ${wpdb_prefix}_posts set guid = replace(guid, $old_site, $new_site);
# Replace title, excerpt and content
update ${wpdb_prefix}_posts set post_title = replace(post_title, $old_site, $new_site);
update ${wpdb_prefix}_posts set post_excerpt = replace(post_excerpt, $old_site, $new_site);
@jseidl
jseidl / curlopt_codes.txt
Created July 31, 2012 17:19
CURLOPT codes
CURLOPT_NOTHING = 0;
CURLOPT_FILE = 10001;
CURLOPT_URL = 10002;
CURLOPT_PORT = 3;
CURLOPT_PROXY = 10004;
CURLOPT_USERPWD = 10005;
CURLOPT_PROXYUSERPWD = 10006;
CURLOPT_RANGE = 10007;
CURLOPT_INFILE = 10009;
CURLOPT_ERRORBUFFER = 10010;