this repo has no description
1gbre() {
2 local count=${1:-10}
3 local email=${2:-"thrast36@gmail.com"}
4
5 git for-each-ref --sort=-committerdate refs/heads \
6 --format="%(refname:short) %(committeremail)" |
7 awk -v email="$email" '$2 == "<"email">" {print $1}' |
8 head -n $count
9}
10
11git_exclude() {
12 echo "$1" >> .git/info/exclude
13}
14
15mv_ext() {
16 if [ "$#" -ne 3 ]; then
17 echo "Usage: mv_ext <dir> <from_ext> <to_ext>"
18 return 1
19 fi
20
21 local dir="$1"
22 local from_ext="$2"
23 local to_ext="$3"
24
25 if [ ! -d "$dir" ]; then
26 echo "Error: Directory '$dir' does not exist."
27 return 1
28 fi
29
30 find "$dir" -type f -name "*.$from_ext" -exec bash -c 'mv "$0" "${0%.$1}.$2"' {} "$from_ext" "$to_ext" \;
31
32 echo "Renamed all .$from_ext files to .$to_ext in $dir"
33}
34
35git_rebase_main() {
36 current_branch=$(git branch --show-current)
37 git checkout main
38 git pull origin main
39 git checkout "$current_branch"
40 git rebase main
41}
42
43find_err() {
44 local package=$1
45 local command=$2
46 local start_version=$3
47 local reverse=$4
48
49 versions=($(pip index versions "$package" | rg -o '\d+\.\d+\.\d+' | sort -V -u))
50 if [[ "$reverse" == "reverse" ]]; then
51 versions=($(echo "${versions[@]}" | tr ' ' '\n' | sort -rV -u))
52 fi
53
54 echo "Testing $package versions starting from $start_version"
55 echo "Command: $command"
56 echo "-------------------------------------------"
57
58 local start=false
59 local last_working_version=""
60
61 for version in "${versions[@]}"; do
62 if [[ "$version" == "$start_version" || "$start" == true ]]; then
63 start=true
64 printf "Testing v%-10s" "$version"
65
66 if output=$(uv run --with "$package==$version" python -c "$command" 2>&1); then
67 echo " ok"
68 last_working_version=$version
69 else
70 echo " FAIL"
71 echo -e "\nFirst failing version: $version"
72 echo "Last working version: $last_working_version"
73 echo -e "\nError:"
74 echo "$output" | tail -n 3
75 break
76 fi
77 fi
78 done
79}
80
81# --- moved from aliases (complex quoting) ---
82
83ghistory() {
84 git log --graph --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%an%C(reset)%C(bold yellow)%d%C(reset) %C(dim white)- %s%C(reset)' --all
85}
86
87pid2port() {
88 lsof -nP -iTCP -sTCP:LISTEN | rg "$(ps aux | rg "$1" | awk '{print $2}' | paste -sd '|' -)"
89}
90
91mern() {
92 echo "User: $(whoami), Host: $(hostname), IP: $(ifconfig | rg -o 'inet (\d{1,3}\.){3}\d{1,3}' | rg -v '127.0.0.1' | rg -v '255$' | rg -o '(\d{1,3}\.){3}\d{1,3}')"
93}