Skip to content

Instantly share code, notes, and snippets.

View foxel's full-sized avatar
🇦🇲

Andrey Kupreychik foxel

🇦🇲
View GitHub Profile
@foxel
foxel / midpass.js
Created February 27, 2023 15:33 — forked from bushaev-denis/midpass.js
Midpass calendar notify has available record
const beep = (date) => {
const context = new AudioContext();
const oscillator = context.createOscillator();
oscillator.type = "sawtooth";
oscillator.frequency.value = 1200;
oscillator.connect(context.destination);
oscillator.start();
if (confirm("Появилась запись")) {
oscillator.stop();
document.location.href = 'https://q.midpass.ru/ru/Booking/Date?serviceId=54030d6a-e145-08e2-60fb-33344fac2455&date=' + date;
@foxel
foxel / backup-to-Glacier.sh
Last active December 2, 2021 07:37 — forked from macbookandrew/backup-to-Glacier.sh
Ubuntu incremental encrypted backups to S3/Glacier
#!/bin/bash
#
# Note, to pull a file from s3 use "s3cmd get s://bucket/file destinationfile"
# You must have the proper .s3cfg file in place to decrypt the file.
# You may also use "gpg encryptedfile" and supply the encryption code if you download
# from the web interface. Good luck.
# The bucket should be set to transfer to Glacier. To retreive, you need to initiate a
@foxel
foxel / deep_keys.type.ts
Last active March 2, 2021 07:37
TypeScript 4.1 deep keys extraction type.
// TypeScript 4.1 deep keys extraction type
// combination of https://flut1.medium.com/deep-flatten-typescript-types-with-finite-recursion-cb79233d93ca
// and https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#key-remapping-in-mapped-types
type KeysPrependRecursor<T, P extends string> = {
[K in keyof T as `${P}.${string & K}`]: T[K] extends Object ? KeysPrependRecursor<T[K], `${P}.${string & K}`> : T[K]
}
type KeysPrepend<T> = {
[K in keyof T]: T[K] extends Object ? KeysPrependRecursor<T[K], `${string & K}`> : T[K]
}
@foxel
foxel / configuration.yaml
Last active January 27, 2021 11:33
HA custom component for controlling Keenetic 3G internet link with ZTE MF833 modem
switch:
- platform: modem_control
name: Megafon Internet
host: !secret router_ip
username: !secret router_username
password: !secret router_password
@foxel
foxel / VaryTempWithHeight.py
Created October 31, 2018 15:17
Cura 3 VaryTempWithHeight post processing script for temp towers.
# -*- coding: utf-8 -*-
import json
import re
from ..Script import Script
class VaryTempWithHeight(Script):
def __init__(self):
@foxel
foxel / VaryTempWithHeight.py
Created October 31, 2018 15:18
Cura 3 VaryTempWithHeight post processing script for temp towers.
# -*- coding: utf-8 -*-
import json
import re
from ..Script import Script
class VaryTempWithHeight(Script):
def __init__(self):
@foxel
foxel / CsvTable.php
Last active June 7, 2019 16:38
CSV Data MediaWiki extension
<?php
/*
* CSV Data MediaWiki extension.
*
* Additional parameters allowed in the tag are:
* sep Specify a separator; ',' is default.
* head Specify a heading; "head=top" makes the first row a heading,
* "head=left" makes the first column a heading, "head=topleft"
* does both.
@foxel
foxel / controlEverything-SI7021.py
Created April 26, 2017 15:57
Python example for SI7021 board from ControlEverything
#!/usr/bin/python
import sys
from time import sleep, strftime
from OmegaExpansion import onionI2C # requires fixes for https://github.com/OnionIoT/i2c-exp-driver/issues/13
while True:
i2c = onionI2C.OnionI2C()
i2c.write(0x40, [0xE5])
sleep(0.1)
@foxel
foxel / !haproxy+docker-gen.md
Last active January 23, 2019 11:50
Haproxy + docker-gen hostname routing

What is this?

This gist includes config for haproxy + docker-gen system with routing http requests to different containers based on hostname label.

pre requirements

#!/usr/bin/python2.7
import sys
# assuming you have https://github.com/foxel/noolite-mqtt-python near
from noolite_serial import NooLiteSerial
noo_serial = NooLiteSerial('/dev/ttyS0')
if len(sys.argv) < 3:
raise Exception('Not Enough params. Usage: noo.py [ch] [cmd]')