Skip to content

Instantly share code, notes, and snippets.

Uncommon Linux Commands

This is a collection of linux commands that have been helpful to me but mostly not used often enough to just remember them off the top of my head. Some are definitely better documented than others...

Active Directory / SSSD / Samba

# various methods to join and remove from AD based on OS version and AD settings
kinit admin@CORP.DOMAIN.COM
net ads join -v -k -U admin@CORP.DOMAIN.COM createcomputer="/ORG/Servers/LinuxServers"
@datavudeja
datavudeja / conftest.py
Created February 9, 2025 22:22 — forked from giladbarnea/conftest.py
conftest.py with every trick i know for pytest
'''
[tool.poe.tasks.test]
cmd = "pytest"
env = { OBJC_DISABLE_INITIALIZE_FORK_SAFETY="YES", DISABLE_SPRING="true" } # pytest-parallel
[tool.pytest.ini_options]
log_format = "[%(levelname)-5s %(asctime)s %(name)s@%(filename)s:%(lineno)d %(funcName)s] %(message)s"
log_auto_indent = 2
addopts = """
--color=yes
@datavudeja
datavudeja / monitor.py
Created February 9, 2025 22:23 — forked from pjbull/monitor.py
Terminal process monitoring in Python
from collections import Counter, deque
from copy import copy
from dataclasses import dataclass, asdict
import datetime
from itertools import islice
import json
import os
from pathlib import Path
import sys
import time
@datavudeja
datavudeja / collect.py
Created February 9, 2025 22:23 — forked from Kludex/collect.py
Scripts used to generate the list of objects on https://github.com/pydantic/pydantic/pull/5480
import importlib
import pkgutil
def get_public_objects(package_name, parent_module=""):
objects = []
full_package_name = (
parent_module + "." + package_name if parent_module else package_name
)
package = importlib.import_module(full_package_name)
@datavudeja
datavudeja / README.md
Created February 9, 2025 22:25 — forked from seapagan/README.md
Read lines from a process using Python without blocking

Read lines from a process using Python

This is a quick example how to read stdin / stderr lines from a process and capture/display in a non-blocking way

In this example I'm running a FastAPI app using uvicorn. Change the commands in the subprocess.Popen line to suit your own usage.

This example uses threading and queues to avoid blocking the main process. It has also been updated to allow a clean exit when ctrl-C is pressed, and still collect all the output

@datavudeja
datavudeja / github_downloader.py
Created February 9, 2025 22:26 — forked from VictorLG98/github_downloader.py
Github repo downloader
import os
import subprocess
import requests
from scrapy import Selector
from rich import print as rprint
from rich.prompt import Prompt
import click
from urllib.parse import urljoin
@click.command()
@datavudeja
datavudeja / recursive_convert.py
Created February 9, 2025 22:26 — forked from mnixry/recursive_convert.py
Recursively convert videos in a specified folder with FFmpeg
import argparse
import re
import shutil
import subprocess
from datetime import datetime, timedelta
from fnmatch import fnmatch
from mimetypes import guess_type
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import NamedTuple, Optional, cast
@datavudeja
datavudeja / get_dataverse_doi.py
Created February 9, 2025 22:27 — forked from Teque5/get_dataverse_doi.py
Dataverse DOI Scraper
#!/usr/bin/env python3
# SPDX-FileContributor: 2023 The Aerospace Corporation
# SPDX-DocumentComment: Approved 2023-10-23 Request # OSS23-0008
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Dataverse Scraper"""
import argparse
from pathlib import Path
import hashlib
import logging
import subprocess
@datavudeja
datavudeja / pb.py
Created February 9, 2025 22:27 — forked from imaurer/pb.py
Configurable script for filtering files found in a git repo and copying content to clipboard
#!/usr/bin/env -S uv --quiet run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "click",
# "pyperclip",
# "pathspec",
# "rich",
# ]
# ///
@datavudeja
datavudeja / execblock.py
Created February 9, 2025 22:27 — forked from DJRHails/execblock.py
Execute a markdown code block
#!/usr/bin/env python3
from dataclasses import dataclass
from io import StringIO
from pathlib import Path
from rich.console import Console
from rich.panel import Panel
from rich.table import Table
from typing import Optional
import contextlib