Skip to content

Instantly share code, notes, and snippets.

@palashmon
palashmon / Readme.md
Last active March 16, 2025 18:51
Creating JSDoc `@types` for Different Data Types in JavaScript
@csm10495
csm10495 / locked_cookie_test.py
Last active April 5, 2025 19:59
POC that fetches cookies from a locked cookies file on Windows with Chromium based browsers
@twolfson
twolfson / README.rst
Last active February 17, 2025 19:19
Evaluation and comparison of various Python templating libraries

gist-python-templating-evaluation

@whoisjeeva
whoisjeeva / socks5.py
Created January 15, 2021 11:47
Socks5 proxy server in Python
import socket
import threading
import select
SOCKS_VERSION = 5
class Proxy:
@hosackm
hosackm / colorlog.py
Created July 28, 2020 01:39
Colored logger module using Colorama
import logging
from colorama import init, Fore, Back
init(autoreset=True)
class ColorFormatter(logging.Formatter):
# Change this dictionary to suit your coloring needs!
COLORS = {
"WARNING": Fore.RED,
## Link to excel export of market watch
http://members.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx?d=0&format=0
## Variables list
inscode: "15521712617204216"
iid: "IRO1SFKZ0001"
l18: "سفارس"
l30: "سيمان فارس و خوزستان"
py: "8557"
bvol: "5131363"
@abdalmoez
abdalmoez / python-udp-send-packet.py
Last active February 19, 2025 09:50
Send udp packet using python
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 1234
MESSAGE = "Hello, World!"
print ("UDP target IP:", UDP_IP)
print ("UDP target port:", UDP_PORT)
print ("message:", MESSAGE)
@Paikan
Paikan / reproduction.py
Created November 7, 2019 14:05
Bug in wikitextparser with tables
import json
import wikitextparser
with open("table1.json") as f: # or table2.json
data = json.load(f)
source = data["source_text"]
parsed = wikitextparser.parse(source)
print("Processing tables")
# This one will hang
@dabeaz
dabeaz / aproducer.py
Created October 17, 2019 17:46
"Build Your Own Async" Workshop - PyCon India - October 14, 2019 - https://www.youtube.com/watch?v=Y4Gt3Xjd7G8
# aproducer.py
#
# Async Producer-consumer problem.
# Challenge: How to implement the same functionality, but no threads.
import time
from collections import deque
import heapq
class Scheduler:
@cb109
cb109 / vscode_python_sort_imports_isort_on_save.md
Last active April 16, 2025 07:01
VSCode: Python Sort Imports on File Save (isort)

VSCode: Python Sort Imports on File Save (isort)

Update 2024

VSCode used to have issues with sorting Python imports (2021), as described further down below, but this has since been fixed.

All you need to do to make VSCode use its builtin isort on save is this in your settings.json: