This file contains hidden or 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 socket | |
| def my_ip(): | |
| hostname = socket.gethostname() | |
| return socket.gethostbyname(hostname) | |
| def on_vpn(ip: str, vpn_ip_begin='10.'): | |
| return ip.startswith(vpn_ip_begin) |
This file contains hidden or 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 sys | |
| from PyQt5.QtWidgets import QApplication | |
| from PyQt5.QtGui import QIcon, QPixmap | |
| from PyQt5.QtWidgets import QMainWindow, QMenu, QSystemTrayIcon | |
| green_icon = b"\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x002\x00\x00\x002\x08\x06\x00\x00\x00\x1e?\x88\xb1\x00\x00\x0c\xf3IDATx\x9c\xedY{pT\xd7y\xff}\xe7\xdc{\xb5+\xad\x00\xa1\x07z\xf0\x10\x18$\x12\x84\x93\x16\xb0\x0b*f\x150\xaf)Nl\x03\xf6\xe0d<\xe9\xb4\x9e\x16\xd3d\x92\x99$\x1d:\x8e\xc1u\x9d\xb1'\xe9\xb4um'\x19\xb7\x8e\xebW\x02\x8e\r\xc4\xd8 ;h1\x96\"\xc0\xb2\xb1\xa16P0\x8b\x91\x84@+\t\xc1J\xbb\xdc{\xcf\xfd\xfa\xc7\xee]\xf6qw\x853\xe9L\xd2\xc9oF\xa3\x9d\xbd\xe7~\xdf\xf7;\xdfs\xcf\xa1\xf6\xb7\xf7\xe0\xff\x03\xb4B\x0f\tD\xd7#\x84\xc1\xfc\xdb\x1a\xf0\xbb\xd2Q\x90HysC\xa0\x1c\x15\x05\x15\x0c \x82H\xfb\x89+\xd7c\xcc\xff\xa5\x8e\x82D68\x1bhT\x0ck\x86,\xca\xbb\x1b\x93\xa4\x8f\x1f\xe46\r\xa1\x90]\xd0\x9a<\xf8;c\x83\xbc\xa0\xe2y\xbd2\x0c\x80\xac\x11\xf5|\xf0\xc3\x82:<\x89\x84\x83a\xdf=7\xdf\xa3\xe3\xc5\xdf|W\xd4`\x99\x13'\x13`\x99\xb5L\x01\xa4\xd1e>\x83\x9a5\x |
This file contains hidden or 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
| def shorten_end(string, width=80, placeholder=' ...'): | |
| if len(string) <= width: | |
| return string | |
| n2 = width - len(placeholder) | |
| return string[:n2] + placeholder | |
| def shorten_begin(string, width=80, placeholder='... '): | |
| if len(string) <= width: | |
| return string | |
| n1 = len(string) - width + len(placeholder) |
This file contains hidden or 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
| def are_strings_grouped(list_of_strings): | |
| # First find the number of expected changes | |
| n_unique_strings = len(set(list_of_strings)) | |
| n_expected_changes = n_unique_strings - 1 | |
| # Then find the real number of changes | |
| groups_channges = [1 for former, latter | |
| in zip(list_of_strings[:-1], list_of_strings[1:]) | |
| if former != latter] | |
| n_real_changes = sum(groups_channges) | |
| # Finally compare them |
This file contains hidden or 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 json | |
| import subprocess | |
| import time | |
| def read_label( | |
| filepath, | |
| full_result=False, | |
| powershell=r'C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe', | |
| stdout_encoding='iso8859-15', |
This file contains hidden or 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
| from time import sleep | |
| from datetime import datetime, timedelta | |
| def wait(until, | |
| update_time=1, | |
| waiting_message='Waiting...', | |
| done_message='Done'): | |
| print(waiting_message) | |
| while ( |
OlderNewer