Skip to content

Instantly share code, notes, and snippets.

View zlondrej's full-sized avatar

Ondřej Janošík zlondrej

  • Czech Republic
  • 22:58 (UTC +02:00)
View GitHub Profile
@zlondrej
zlondrej / py-venv-wrapper.sh
Created March 5, 2024 15:47
Python virtual environment wrapper
#!/usr/bin/env bash
# This script is a wrapper for creating and managing Python virtual environments.
# Usage:
# py-venv-wrapper.sh <command>
# Run the script in the directory containing the requirements.txt file.
# The script will create a virtual environment in the ".venv" directory
# and execute the command within the virtual environment.
@zlondrej
zlondrej / git-prune-branches
Created June 30, 2021 12:55
Prune local GIT branches no longer tracked by remote
#!/usr/bin/bash
# Removes local branches that are no longer tracked on remote
set -e
branches=($(git branch -vv | grep ": gone" | grep -v "^+" | sed -r 's/^ *([^ ]+).*$/\1/'))
if (( ${#branches[@]} == 0 )); then
echo "Nothing to prune"
@zlondrej
zlondrej / auto-xboxdrv
Created March 10, 2016 23:03
Script for xboxdrv automatic start
#!/bin/bash
set -ex
declare -a pids=()
if (( $EUID != 0 )); then
sudo "$0" "$@"
exit 0
fi