Skip to content

Instantly share code, notes, and snippets.

View h4's full-sized avatar
💭
I may be slow to respond.

Mikhail Baranov h4

💭
I may be slow to respond.
View GitHub Profile
@h4
h4 / env.py
Last active March 13, 2024 07:22
Setup alembic to work properly with PostgreSQL schemas
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
from models import Base
config = context.config
fileConfig(config.config_file_name)
@h4
h4 / base.html
Created February 8, 2012 18:54
Способы подключения css
<!-- подключение внешнего файла css -->
<head>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
@h4
h4 / rename.py
Created May 28, 2020 14:53
Rename alembic revisions with new format
#!/usr/bin/env python3
import subprocess
import time
from os import walk, path, chdir
import re
regex = re.compile(r'([0-9a-f]+)_(\w+)\.py')
date_re = re.compile(r'(\d+)-(\d+)-(\d+) (\d+):(\d+)')
chdir('/alembic_/versions')
for root, dirs, files in walk('/alembic_/versions'):
@h4
h4 / 01.getElementsByTagName.html
Created April 12, 2012 08:57
Работа с DOM
<!--
* Метод document.getElementsByTagName()
-->
<html>
<head>
<script type="text/javascript">
function getElements() {
var x=document.getElementsByTagName("input");
console.log(x.length);
@h4
h4 / MJ_HT_V1.txt
Created May 21, 2019 14:04
MJ_HT_V1 sensor available characteristics
Service: 00001800-0000-1000-8000-00805f9b34fb
Characteristic: 00002a00-0000-1000-8000-00805f9b34fb
READ WRITE
b'MJ_HT_V1'
Characteristic: 00002a01-0000-1000-8000-00805f9b34fb
READ
b'\x00\x03'
Characteristic: 00002a04-0000-1000-8000-00805f9b34fb
READ
b'\x10\x00<\x00\x00\x00\x90\x01'
@h4
h4 / demo.ino
Created November 13, 2020 11:28
/*
Created 2016
by AlexGyver
AlexGyver Home Labs Inc.
*/
char masschar[5]; //массив символов для перевода
String massstring; //строка, в которую задаётся масса в режиме выбора массы
int set,setmass,rapidtime;
boolean initial,flagmass, flagmassset, rapidflag; //флажки
int n=1; //номер выстрела, начиная с 1
@h4
h4 / LYWSD02.txt
Created May 20, 2019 06:48
LYWSD02 sensor available characteristics
Service: 00001800-0000-1000-8000-00805f9b34fb
Characteristic: 00002a00-0000-1000-8000-00805f9b34fb
READ
b'LYWSD02'
Characteristic: 00002a01-0000-1000-8000-00805f9b34fb
READ
b'\x00\x00'
Service: 00001801-0000-1000-8000-00805f9b34fb
Characteristic: 00002a05-0000-1000-8000-00805f9b34fb
READ INDICATE
def sum(a, b):
return a + b
print(sum(1, 3))
@h4
h4 / overlay.css
Created February 29, 2012 22:35
Полупрозрачный оверлей
.overlay {
position: fixed;
z-index: 100;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #000;
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=55);
opacity: 0.55;
@h4
h4 / ClearGrass.txt
Last active November 4, 2019 20:43
Xiaomi BLE Temperature/Humidity Sensors
00001800-0000-1000-8000-00805f9b34fb Generic Access
00002a00-0000-1000-8000-00805f9b34fb READ WRITE
b'ClearGrass Temp & RH'
Device Name
00002a01-0000-1000-8000-00805f9b34fb READ
b'\x00\x00'
Appearance
00002a04-0000-1000-8000-00805f9b34fb READ
b'\x10\x00<\x00\x00\x00\x90\x01'
Peripheral Preferred Connection Parameters