Skip to content

Instantly share code, notes, and snippets.

View patkepa's full-sized avatar
🙉
Embedded Development

Patryk Kępa patkepa

🙉
Embedded Development
View GitHub Profile
@patkepa
patkepa / git-submodule-tree.sh
Created June 30, 2025 10:22
Shorts tree like structure for submodules in repositories.
#!/bin/bash
# Git Submodule Dependency Tree Generator
# Usage: ./git-submodule-tree.sh <github-repo-url>
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
@patkepa
patkepa / migrate-repo.sh
Last active June 26, 2025 10:04
Bash script for no commit migration of repos between private organizations.
#!/bin/bash
# Script to migrate a repository between private organizations
# Usage: ./migrate-repo.sh <github-url> [branch-or-all] [target-org-or-user]
#
# Arguments:
# github-url: Source repository URL
# branch-or-all: Specific branch name OR "all" to migrate all branches and tags
# target-org-or-user: (Optional) Target organization or username for the new repo
# If not specified, uses DEFAULT_TARGET (if set) or authenticated user
@patkepa
patkepa / IP101_PHY_ESP32.ino
Last active November 15, 2024 14:56
Implementation of IP101_PHY Ethernet on ESP32. A copy made based on this thread: https://github.com/espressif/arduino-esp32/issues/3554 Thanks to DheeranYuvaraj. You will very likely require to put your ESP32 boards version to 2.0.6 or similar for this sketch to work.
#include <ETH.h>
#define ETH_ADDR 1
#define ETH_POWER_PIN 5
#define ETH_MDC_PIN 23
#define ETH_MDIO_PIN 18
#define ETH_TYPE ETH_PHY_IP101
static bool eth_connected = false;

OCR and Audio Transcription Script

This script performs Optical Character Recognition (OCR) on images within a specified folder and extracts and transcribes audio from a video file. The extracted text from images and the transcription from the audio are saved in separate output text files.

Features

  • OCR from Images: Extracts text from all image files in a specified folder (frames) and saves it to knowledge2.txt one directory level up.
  • Audio Transcription: Extracts audio from a specified video file (input.mkv), transcribes it using the Whisper model, and saves the transcription to a text file named input-transcription.txt.
@patkepa
patkepa / flatpak_manager.py
Created March 26, 2023 23:22
A small script for downloading current flatpak packages and installing them
import subprocess
import re
import os
def list_flatpak_packages():
# Define a list of strings to exclude
exclude_list = ["mesa", "org.gnome.Platform", "org.kde.Platform", "org.gnome.Sdk", "org.freedesktop.", "org.winehq." ]
# Run the "flatpak list" command and capture the output
output = subprocess.check_output(['flatpak', 'list'], universal_newlines=True)
@patkepa
patkepa / nushell.md
Last active August 5, 2025 22:39
Adding nushell as default shell

Adding nushell as default shell

If you try to add nushell as your default terminal with chsk, you'll encounter an error because nushell isn't added to the /etc/shells list by default. To add it to the whitelist, append your nu binary file to etc/shells

echo 'usr/bin/nu' | sudo tee -a /etc/shells

After it is added, you can set it as default shell with

chsh -s (which nu)

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@patkepa
patkepa / Linux-tweaks.md
Last active March 24, 2023 04:05
Linux tweaks for Ubuntu/Debian

Linux tweaks

I compiled a list of useful tweaks I usually use while configuring my freshly installed distro.

Everything in this guide is made of Ubuntu/Debian based systems in mind, so it might not function the same on different package managers and distros

Battery management

Powertop

First install then calibrate Powertop