Skip to content

Instantly share code, notes, and snippets.

View bedilbek's full-sized avatar
🎯
Focusing

Bedilbek Khamidov bedilbek

🎯
Focusing
View GitHub Profile

Type checking (vscode)

For now we can skip checking with ty unless they add full pydantic support: astral-sh/ty#2403 Thus if you have ty installed and enabled then we need to change to Pylance:

code --list-extensions | grep -iE 'ty|pylance|python|mypy|pyright'
@bedilbek
bedilbek / now.py
Created March 21, 2025 08:45
datetime-now
#!/usr/bin/python3
import sys
from datetime import datetime, timezone
import argparse
def main(args):
time = datetime.now(timezone.utc).replace(tzinfo=None)
print(time.isoformat(timespec="milliseconds") + "Z")
print(time.timestamp())
@bedilbek
bedilbek / README.md
Last active December 21, 2024 09:33
Github Activity Summary for last N days

Github Summary Generator

Install the requirements:

pip install markdown requests

Change the following lines in the code:

username = ""
@bedilbek
bedilbek / Dockerfile
Last active May 16, 2024 09:00
Python Server for Time Retrieval of server
FROM python:3.12-alpine
EXPOSE 8123
WORKDIR /app
RUN <<EOF cat >> /app/http_time_server.py
import http.server
import socketserver
import time
@bedilbek
bedilbek / Dockerfile
Last active April 19, 2024 09:14
tshark Docker Image
FROM ubuntu:22.04 as builder
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates wget xz-utils build-essential cmake \
libglib2.0-dev libgcrypt20-dev flex \
yacc bison byacc libpcap-dev libssh-dev \
libsystemd-dev libc-ares-dev libspeexdsp-dev
@bedilbek
bedilbek / ctte.py
Last active March 21, 2025 08:50
Datetime string to epoch and vice versa
#!/usr/bin/python3
"""
Examples:
------------------------------------------------------
echo "1742546018015123" | ctte.py --reverse --us
2025-03-21T08:33:38.015Z
2025-03-21T08:33:38.015123Z
@bedilbek
bedilbek / colorize
Created July 20, 2023 08:56
colorize script
#!/usr/bin/zsh
RED=$(echo -e "\e[31m")
RESET=$(echo -e "\e[39m")
while read line; do
echo "$RED$line$RESET"
done
@bedilbek
bedilbek / qt-install.sh
Last active June 6, 2023 21:14
Install Qt5 on Ubuntu
### https://wiki.qt.io/Install_Qt_5_on_Ubuntu#Installation_Guide_.28Qt_download_page.29
## if you need to install dependencies uncomment below lines
# sudo apt-get install build-essential
# sudo apt-get install libfontconfig1
# sudo apt-get install mesa-common-dev
# sudo apt-get install libglu1-mesa-dev -y
wget https://download.qt.io/new_archive/qt/5.7/5.7.0/qt-opensource-linux-x64-5.7.0.run
@bedilbek
bedilbek / app.py
Created March 21, 2023 13:53
Fast API template
# taken from https://github.com/tiangolo/fastapi/issues/617#issuecomment-840626819
from dataclasses import dataclass
from functools import partial
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseSettings
@bedilbek
bedilbek / cuda_changer.sh
Created October 22, 2022 11:09
Cuda Changer Bash script
#!/bin/bash
set -e
INSTALL_DIR="/usr/local"
TARGET_VERSION=${1}
default_info () {
echo "The following cuda installations have been found (in '${INSTALL_DIR}'):"
available_cudas=$(ls -a "${INSTALL_DIR}" | grep "cuda-" | sed 's/cuda-//')