Skip to content

Instantly share code, notes, and snippets.

@Bouni
Bouni / passman-dump.py
Created January 21, 2020 08:21
Passman vault backup script (with decryption proof of concept)
#!/usr/bin/env python3
import base64
import json
import logging
import os
import sys
from datetime import datetime as dt
import click
@Bouni
Bouni / config.yaml
Created January 16, 2020 15:04
Besispiel config
accounts:
- name: Musterstadt
mail:
host: imap.mailprovider.de
user: [email protected]
password: Feuer!
subject: "Einsatzmeldung"
connect:
token: >-
E-pzIiYlxxTdFu8w9a-KWNVHv-4jIqRdg5UKyiwRE24soOJNDHyFi9MHXDzHICJUQ9O
@Bouni
Bouni / notes.txt
Created January 10, 2020 18:52
Micropython
# install packages
yay -S esptool
sudo pip install rshell
# flash micropython
- Download: https://micropython.org/download#esp32 (GENERIC : esp32-idf3-20200110-v1.12-45-gbfbd94401.bin)
- Erase flash: esptool.py --port /dev/ttyUSB0 erase_flash
- Flash firmware: esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 <esp32-....bin>
@Bouni
Bouni / arch-install.sh
Last active December 4, 2019 20:42
Arch linux install script
#
# 1. loadkeys us
# 2. passwd (set password for user root)
# 3. systemctl start sshd
# 4. ssh into system to work directly and not via VNC
# 5. wget this file
# 6. bash ./arch-install.sh
# 7. reboot
#
@Bouni
Bouni / mailchecker.py
Created November 18, 2019 16:11
Read unseen mails to console
# -*- coding: utf-8 -*-
import os
import sys
import logging
import ssl
import email
from imaplib import IMAP4_SSL
LOGGER = logging.getLogger("mailchecker")
@Bouni
Bouni / auto_venv
Created November 15, 2019 07:16
Auto activate virtualenv when cd'ing into the parent folder
# https://stackoverflow.com/questions/45216663/how-to-automatically-activate-virtualenvs-when-cding-into-a-directory
function cd() {
builtin cd "$@"
if [[ -z "$VIRTUAL_ENV" ]] ; then
## If env folder is found then activate the vitualenv
if [[ -d ./venv ]] ; then
source ./venv/bin/activate
fi
cd home-assistant/homeassistant/components
rg -c "(\s{4,}import.*$)|(\s{4,}from\s+[\w_.]+.*$)" *
aftership/sensor.py:1
alarmdecoder/__init__.py:3
arcam_fmj/config_flow.py:1
ambient_station/config_flow.py:2
asuswrt/__init__.py:1
braviatv/media_player.py:2
canary/sensor.py:1
@Bouni
Bouni / rg.txt
Last active October 17, 2019 05:53
ripgrep result of non top level imports
cd home-assistant/homeassistant/components
rg -t py --line-number "(\s{4,}import.*$)|(\s{4,}from\s+[\w_.]+.*$)" *
==================================================================================================================
aladdin_connect/cover.py line: 43 from aladdin_connect import AladdinConnectClient
airvisual/sensor.py line: 100 from pyairvisual import Client
airvisual/sensor.py line: 252 from pyairvisual.errors import AirVisualError
aftership/sensor.py line: 59 from pyaftership.tracker import Tracking
alarmdotcom/alarm_control_panel.py line: 52 from pyalarmdotcom import Alarmdotcom
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib/python3.7/logging/__init__.py", line 1028, in emit
stream.write(msg + self.terminator)
File "/home/bouni/projects/home-assistant/venv/lib/python3.7/site-packages/_pytest/capture.py", line 427, in write
self.buffer.write(obj)
ValueError: I/O operation on closed file
Call stack:
File "/usr/lib/python3.7/asyncio/base_events.py", line 1639, in call_exception_handler
self._exception_handler(self, context)
py37 inst-nodeps: /home/bouni/projects/home-assistant/.tox/.tmp/package/2/homeassistant-0.101.0.dev0.zip
py37 installed: acme==0.38.0,adb-shell==0.0.5,adguardhome==0.2.1,aenum==2.2.1,aio-geojson-client==0.10,aio-geojson-geonetnz-quakes==0.10,aioambient==0.3.2,aioautomatic==0.6.5,aiobotocore==0.10.2,aiocache==0.11.1,aiocoap==0.4a1,aioesphomeapi==2.2.0,aiohttp==3.6.1,aiohttp-cors==0.7.0,aiohue==1.9.2,aionotion==1.1.0,aioswitcher==2019.4.26,aiounifi==11,aiowwlln==2.0.2,airly==0.0.2,Ambiclimate==0.2.1,androidtv==0.0.29,apns2==0.3.0,appdirs==1.4.3,aprslib==0.6.46,arrow==0.12.1,asn1crypto==1.0.1,aspy.yaml==1.3.0,astral==1.10.1,astroid==2.2.5,async-generator==1.10,async-timeout==3.0.1,asynccmd==0.2.4,asynctest==0.13.0,atomicwrites==1.3.0,attrs==19.2.0,av==6.1.2,axis==25,bcrypt==3.1.7,beautifulsoup4==4.8.1,bellows-homeassistant==0.10.0,black==19.3b0,boto3==1.9.246,botocore==1.12.91,cachetools==3.1.1,caldav==0.6.1,casttube==0.2.0,certifi==2019.9.11,cffi==1.12.3,cfgv==2.0.1,chardet==3.0.4,cheroot==8.0.0,CherryPy==17.3.