Skip to content

Instantly share code, notes, and snippets.

View eigenein's full-sized avatar
🐌
I may be slow to respond.

Pavel Perestoronin eigenein

🐌
I may be slow to respond.
View GitHub Profile
@eigenein
eigenein / stream.service
Last active April 5, 2022 16:11
Re-streaming Nest cam to YouTube
[Unit]
Description = Wilck
BindsTo = network-online.target
After = network.target network-online.target
[Service]
WorkingDirectory = /home/pi
StandardOutput = journal
StandardError = journal
Restart = always
@eigenein
eigenein / LYWSD02.txt
Last active August 25, 2020 17:16
LYWSD02 BLE
$ sudo stdbuf -oL hcitool lescan | grep LYWSD02
E7:2E:00:F0:20:8A LYWSD02
$ sudo hcitool leinfo E7:2E:00:10:50:A2
Requesting information ...
Handle: 65 (0x0041)
LMP Version: 4.2 (0x8) LMP Subversion: 0x10f
Manufacturer: Dialog Semiconductor B.V. (210)
Features: 0x1f 0x00 0x00 0x00 0x00 0x00 0x00 0x00
@eigenein
eigenein / nestbox-on-raspberry-pi.md
Last active September 3, 2020 11:51
Nestbox on Raspberry Pi Zero W

Initial setup

On the local machine:

ssh-copy-id pi@nestkastpi.local

On the Raspberry Pi:

@eigenein
eigenein / model_selection.py
Created August 26, 2018 12:29
TTestSearchCV
class TTestSearchCV:
def __init__(self, estimator, param_grid, *, cv, scoring, alpha=0.95):
self.estimator = estimator
self.param_grid: Dict[str, Any] = param_grid
self.cv = cv
self.scoring = scoring
self.alpha = alpha
self.p = 1.0 - alpha
self.best_params_: Optional[Dict[str, Any]] = None
@eigenein
eigenein / strategy.py
Created April 26, 2016 18:33
CodeRunner 2015
#!/usr/bin/env python3
# coding: utf-8
from collections import deque, namedtuple
from math import pi, copysign, cos, sin
from typing import Tuple
from model.Car import Car
from model.CarType import CarType
from model.Game import Game
@eigenein
eigenein / choose.py
Last active February 20, 2016 21:49
Choose random element from an arbitrary sequence
def choose(seq):
chosen = None
for i, el in enumerate(seq):
if random.random() >= 1.0 - 1.0 / (i + 1):
chosen = el
return chosen
#
# blowfish.py
# Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
#
# This module is open source; you can redistribute it and/or
# modify it under the terms of the GPL or Artistic License.
# These licenses are available at http://www.opensource.org
#
# This software must be used and distributed in accordance
# with the law. The author claims no liability for its
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The Snowball stemmer.
Pavel Perestoronin © 2013
"""
import re
import unittest
@eigenein
eigenein / pyDes.py
Created October 10, 2011 11:33
A pure python implementation of the DES and TRIPLE DES encryption algorithms
#############################################################################
# Documentation #
#############################################################################
# Author: Todd Whiteman
# Date: 16th March, 2009
# Verion: 2.0.0
# License: Public Domain - free to do as you wish
# Homepage: http://twhiteman.netfirms.com/des.html
#