View start_cloak.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Self-elevate the script if required | |
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { | |
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { | |
# $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments | |
# Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine | |
Start powershell.exe -Verb RunAs -ArgumentList "cd $pwd; & $($MyInvocation.MyCommand.Path)" | |
Exit | |
} | |
} |
View environ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROOT=~/venv | |
RED='\e[0;31m' | |
GREEN='\e[0;32m' | |
LIGHTBLUE='\e[1;34m' | |
NC='\e[0m' # No Color | |
trim() { | |
# Remove the leading and trailing whitespaces | |
# https://stackoverflow.com/a/12973694 | |
echo $1 | xargs |
View .python-version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3.9.13 | |
3.10.9 | |
3.8.10 |
View example.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def Main(): | |
x = os.getpid() | |
print(f"{x=}") | |
if __name__ == '__main__': | |
Main() |
View typer_abbr_args.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typer | |
def main( | |
hello: int = typer.Option(None), | |
there: int = typer.Option(None), | |
infinite: bool = typer.Option(False), | |
) -> None: | |
print(hello, there, infinite) | |
if __name__=='__main__': |
View table_split_w_headers.bas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub tableSplitWithHeaders() | |
'https://stackoverflow.com/questions/8668311/current-row-in-vba-word | |
'https://www.tek-tips.com/viewthread.cfm?qid=1610014 | |
'https://stackoverflow.com/questions/37999841/how-can-i-determine-the-page-number-of-a-table-in-ms-word-macro | |
'https://learn.microsoft.com/en-us/office/vba/api/word.selection.insertbreak | |
Const TITLE_CONTINUE As String = "Продолжение таблицы" | |
Const TITLE_END As String = "Окончание таблицы" | |
Dim t As Table, t2 As Table, r As row |
View compare.bas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub compare() | |
Dim sh1 As Worksheet, sh2 As Worksheet | |
Set wb1 = ThisWorkbook | |
Set wb2 = Workbooks("Map B00 XP__20210617_.XLSX") | |
For Each sh1 In wb1.Worksheets | |
Set sh2 = wb2.Worksheets(sh1.Name) | |
If sh1.UsedRange.Address <> sh2.UsedRange.Address Then | |
Debug.Print sh1.Name | |
Else | |
For Each c In sh1.UsedRange |
View pyarrow_repack_groups.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
https://stackoverflow.com/questions/68708477/repartition-large-parquet-dataset-by-ranges-of-values | |
""" | |
import pyarrow as pa | |
import pyarrow.dataset as ds | |
import pyarrow.compute as pc | |
import pyarrow.parquet as pq | |
from pathlib import Path |
View requests_timeout_retry.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# r = read_timeout_handler(self.session.get, self.url_card, params=params, timeout=[10, 20, 30]) | |
def read_timeout_handler(func, url, timeout, retries=None, params={}, **kw): | |
"Retries on read timeout" | |
if not hasattr(timeout, '__iter__'): | |
timeout = [timeout] * (retries or 1) | |
elif retries is not None: | |
raise ValueError("retries specified along with list of timeouts") | |
for retry, tm in enumerate(timeout): | |
try: |
View docker-compose-kafka.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://dimosr.github.io/kafka-docker/ | |
version: '3.4' | |
services: | |
zookeeper: | |
image: 'bitnami/zookeeper:3.8' | |
ports: | |
- '2181:2181' | |
environment: |
NewerOlder