Skip to content

Instantly share code, notes, and snippets.

View Winand's full-sized avatar
🐍
<-Python

Makarov Andrey Winand

🐍
<-Python
View GitHub Profile
import pickle
import threading
import time
import ipywidgets as widgets
import matplotlib.pyplot as plt
import numpy as np
def init_history_plot():
@Winand
Winand / join_max.py
Last active July 1, 2021 14:11
Соединить числа в одно максимально возможное
# from functools import total_ordering
# @total_ordering
class Int(int):
def __lt__(self, other):
this, that = str(self), str(other)
YES, NO = True, False
if len(this) < len(that): # everything is vice versa
this, that = that, this
YES, NO = NO, YES
BI_COMMAND_22
BI_COMMAND_22-BI_COMMAND_TYPE CLEAR_SELECTION_STATE
BI_COMMAND_22-TARGET_DATA_PROVIDER_REF_LIST
BI_COMMAND_22-TARGET_DATA_PROVIDER_REF_LIST-TARGET_DATA_PROVIDER_REF_1 DP_1
BI_COMMAND_22-CHARACTERISTIC ZVCH_NETS
BI_COMMAND_23
BI_COMMAND_23-BI_COMMAND_TYPE CLEAR_SELECTION_STATE
BI_COMMAND_23-TARGET_DATA_PROVIDER_REF_LIST
BI_COMMAND_23-TARGET_DATA_PROVIDER_REF_LIST-TARGET_DATA_PROVIDER_REF_1 DP_3
BI_COMMAND_23-CHARACTERISTIC ZVCH_NETS
@Winand
Winand / to_xml.ps1
Last active July 16, 2020 06:38
csv to Visio xml
$f = Get-Content -Path D:\dat.txt
$data = ConvertFrom-Csv -Delimiter "`t" -InputObject $f
$data = $data | Sort-Object -Property "Тип заявки", "Объект", "Первичный идентификатор"
$groups = $data | Group-Object -Property "Тип заявки"
$xmlsettings = New-Object System.Xml.XmlWriterSettings
$xmlsettings.Indent = $true
foreach ($i in $groups) {
$XmlWriter = [System.Xml.XmlWriter]::Create("D:\$($i.Name).xml", $xmlsettings)
@Winand
Winand / powerpoint_addin_name.bas
Last active November 14, 2019 20:30
`project_name` determines current AddIn name / https://stackoverflow.com/questions/14918464
Function project_id() As Long
' Generate project ID (1-1000) to find it in Application.AddIns collection
Static unique As Long
If unique = 0 Then
Randomize
unique = Int((1000 - 1 + 1) * Rnd + 1)
End If
project_id = unique
End Function
@Winand
Winand / mikrotik_helper
Created August 17, 2018 19:07
mikrotik helper functions
local download do={
# Download file: [$download "src_url" "dst_file"] returns boolean
do {
/tool fetch $1 dst-path=$2
while ([len [/file find name=$2]] = 0) do={delay 0.1}
return true
} on-error={
return false
}
}
@Winand
Winand / cv2.py
Created May 27, 2018 19:50
cv2 image matching test
# -*- coding: utf-8 -*-
"""
Редактор Spyder
Это временный скриптовый файл.
"""
#import numpy as np
#import cv2 as cv
#filename = r"F:\Captura3.PNG"
@Winand
Winand / pooled.py
Created February 10, 2018 14:35
Spyder's IPython and process pools
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 10 16:32:44 2018
@author: МакаровАС
"""
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
import time
tribution
writing manifest file 'pandas.egg-info\SOURCES.txt'
running build_ext
skipping 'pandas\_libs\join.c' Cython extension (up-to-date)
skipping 'pandas\_libs\index.c' Cython extension (up-to-date)
building 'pandas._libs.index' extension
D:\andray\Software\Python\WinPython-32bit-3.4.4.5Qt5\python-3.4.4\Scripts\gcc.ex
e -mdll -O -Wall -Ipandas/_libs/src/klib -Ipandas/_libs/src -ID:\andray\Software
\Python\WinPython-32bit-3.4.4.5Qt5\python-3.4.4\lib\site-packages\numpy\core\inc
lude -ID:\andray\Software\Python\WinPython-32bit-3.4.4.5Qt5\python-3.4.4\include
....
/*
* Wraps `localtime` functionality for multiple platforms. This
* converts a time value to a time structure in the local timezone.
*
* Returns 0 on success, -1 on failure.
*/
static int get_localtime(NPY_TIME_T *ts, struct tm *tms) {
char *func_name = "<unknown>";
#if defined(_WIN32)