Skip to content

Instantly share code, notes, and snippets.

View foxel's full-sized avatar
🇦🇲

Andrey Kupreychik foxel

🇦🇲
View GitHub Profile
{
"definitions": {
"CreateDocumentCommand": {
"type": "object",
"required": ["eventType", "documentName"],
"properties": {
"eventType": {
"type": "string",
"enum": ["CreateDocument"]
},
#!/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]')
@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 / 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 / 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 / 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 / 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;