├── LICENSE ├── README.md ├── bash ├── my_ip.sh ├── neofetch.sh ├── vim_install.sh ├── vim_install_old.sh └── wifi.sh ├── dwmscripts ├── autostart ├── draw_terminal ├── dwmbar └── volume └── python ├── colors.py ├── gh.py ├── spam.py ├── telegram_bot.py ├── translate.py ├── unicode_arrows.py └── vim_startup.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Aquib Javed T 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Some scripts I use. 2 | 3 | ### Get a minimal virmc: 4 | 5 | A oneliner to set up a minimal vimrc on ur machine (another way is to manually download install.sh and execute it) 6 | 7 | ```sh 8 | curl -sL git.io/vim_install | bash 9 | ``` 10 | ### Other scripts: 11 | 12 | #### Bash 13 | 14 | * `neofetch.sh` 15 | * Tweaked version of [NerdFetch](https://github.com/ThatOneCalculator/NerdFetch). 16 | * `my_ip.sh` 17 | * for showing private and public ips. 18 | * `wifi.sh` 19 | * for connecting to wifi via command line. 20 | 21 | #### Python 22 | * `ctf.py` (❗ This was removed in favour of [ice](https://github.com/tamton-aquib/ice)) 23 | * Has 2 functions (for now). 24 | * morse and rot(caesar). 25 | * Usage: `python3 ctf.py rot/morse "The_String"` 26 | * `translate.py` 27 | * Translates other languages to english. 28 | * Converts the text in clipboard. 29 | * Automatically detects the language. (uses googletrans module) 30 | * `vim_startup.py` (❗ Probably wont work anymore as this was from nvim 0.3) 31 | * To get nvim startuptime. 32 | * Along with plugin-timings. 33 | * looks for paq directory for profiling plugin startuptime. 34 | * `colors.py` 35 | * grabs the color where mouse is pointed to on the screen. 36 | * In hex and rgb. 37 | * Requirement: Tkinter. 38 | * `unicode_arrows.py` 39 | * prints some unicode arrow characters. 40 | * Sometimes i use it for terminal customization. 41 | * `gh.py` 42 | * github related commands. 43 | * `issues/pr`, `follow` 44 | -------------------------------------------------------------------------------- /bash/my_ip.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | 3 | # echo "Private: $(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')" 4 | NOICE=$(ifconfig | grep "broadcast" | awk '{print $2}') 5 | echo "Private: $NOICE" 6 | 7 | echo "Public : $(curl -s ifconfig.me)" 8 | -------------------------------------------------------------------------------- /bash/neofetch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## OS/ENVIRONMENT INFO DETECTION 4 | 5 | ostype="$(uname)" 6 | 7 | if command -v getprop > /dev/null; then 8 | linuxtype=android 9 | host="$(getprop net.hostname)" 10 | else 11 | . /etc/os-release 12 | case $ostype in 13 | Linux*) host="$(cat /proc/sys/kernel/hostname)";; 14 | *) host="host" 15 | esac 16 | linuxtype=none 17 | fi 18 | kernel="$(echo $(uname -r) | cut -d'-' -f1-1)" 19 | case $ostype in 20 | "Linux"*) 21 | if [ -f /bedrock/etc/bedrock-release ]; then 22 | os="$(brl version)" 23 | elif [ $linuxtype = android ]; then 24 | os="Android $(getprop ro.build.version.release)" 25 | else 26 | os="${PRETTY_NAME}" 27 | fi 28 | shell=${SHELL##*/};; 29 | "Darwin"*) 30 | while IFS='<>' read -r _ _ line _; do 31 | case $line in 32 | ProductVersion) 33 | IFS='<>' read -r _ _ mac_version _ 34 | break;; 35 | esac 36 | done < /System/Library/CoreServices/SystemVersion.plist 37 | os="macOS ${mac_version}";; 38 | *) os="Idk" 39 | esac 40 | 41 | ## PACKAGE MANAGER AND PACKAGES DETECTION 42 | 43 | manager=$(which nix-env pkg yum zypper dnf rpm apt brew port pacman xbps-query emerge cave apk kiss pmm /usr/sbin/slackpkg yay paru cpm pmm eopkg 2>/dev/null) 44 | manager=${manager##*/} 45 | case $manager in 46 | cpm) packages="$(cpm C)";; 47 | brew) packages="$(printf '%s\n' "$(brew --cellar)/"* | wc -l | tr -d '[:space:]')";; 48 | port) packages=$(port installed | tot);; 49 | apt) packages="$(dpkg-query -f '${binary:Package}\n' -W | wc -l)";; 50 | rpm) packages="$(rpm -qa --last| wc -l)";; 51 | yum) packages="$(yum list installed | wc -l)";; 52 | dnf) packages="$(dnf list installed | wc -l)";; 53 | zypper) packages="$(zypper se | wc -l)";; 54 | pacman) packages="$(pacman -Q | wc -l)";; 55 | yay) packages="$(yay -Q | wc -l)";; 56 | paru) packages="$(paru -Q | wc -l)";; 57 | kiss) packages="$(kiss list | wc -l)";; 58 | pkg|emerge) packages="$(qlist -I | wc -l)";; 59 | cave) packages="$(cave show installed-slots | wc -l)";; 60 | xbps-query) packages="$(xbps-query -l | wc -l)";; 61 | nix-env) packages="$(nix-store -q --requisites /run/current-system/sw | wc -l)";; 62 | apk) packages="$(apk list --installed | wc -l)";; 63 | pmm) packages="$(/bedrock/libexec/pmm pacman pmm -Q 2>/dev/null | wc -l )";; 64 | eopkg) packages="$(eopkg li | wc -l)";; 65 | /usr/sbin/slackpkg) packages="$(ls /var/log/packages | wc -l)";; 66 | *) 67 | packages="$(ls /usr/bin | wc -l)" 68 | manager="bin";; 69 | esac 70 | 71 | ## UPTIME DETECTION 72 | 73 | case $ostype in 74 | "Linux") 75 | IFS=. read -r s _ < /proc/uptime;; 76 | *) 77 | s=$(sysctl -n kern.boottime) 78 | s=${s#*=} 79 | s=${s%,*} 80 | s=$(($(date +%s) - s));; 81 | esac 82 | d="$((s / 60 / 60 / 24))" 83 | h="$((s / 60 / 60 % 24))" 84 | m="$((s / 60 % 60))" 85 | # Plurals 86 | [ "$d" -gt 1 ] && dp=s 87 | [ "$h" -gt 1 ] && hp=s 88 | [ "$m" -gt 1 ] && mp=s 89 | # Hide empty fields. 90 | [ "$d" = 0 ] && d= 91 | [ "$h" = 0 ] && h= 92 | [ "$m" = 0 ] && m= 93 | # Make the output of uptime smaller. 94 | case $uptime_shorthand in 95 | tiny) 96 | [ "$d" ] && uptime="${d}d, " 97 | [ "$h" ] && uptime="$uptime${h}h, " 98 | [ "$m" ] && uptime="$uptime${m}m" 99 | uptime=${uptime%, };; 100 | *) 101 | [ "$d" ] && uptime="$d day$dp, " 102 | [ "$h" ] && uptime="$uptime$h hour$hp, " 103 | [ "$m" ] && uptime="$uptime$m min$mp" 104 | uptime=${uptime%, };; 105 | esac 106 | 107 | ## RAM DETECTION 108 | 109 | case $ostype in 110 | "Linux") 111 | while IFS=':k ' read -r key val _; do 112 | case $key in 113 | MemTotal) 114 | mem_used=$((mem_used + val)) 115 | mem_full=$val;; 116 | Shmem) mem_used=$((mem_used + val));; 117 | MemFree|Buffers|Cached|SReclaimable) mem_used=$((mem_used - val));; 118 | esac 119 | done < /proc/meminfo 120 | mem_used=$((mem_used / 1024)) 121 | mem_full=$((mem_full / 1024));; 122 | "Darwin"*) 123 | mem_full=$(($(sysctl -n hw.memsize) / 1024 / 1024)) 124 | while IFS=:. read -r key val; do 125 | case $key in 126 | *' wired'*|*' active'*|*' occupied'*) 127 | mem_used=$((mem_used + ${val:-0}));; 128 | esac 129 | done <<-EOF 130 | $(vm_stat) 131 | EOF 132 | 133 | mem_used=$((mem_used * 4 / 1024));; 134 | *) 135 | mem_full="idk" 136 | mem_used="idk" 137 | esac 138 | memstat="${mem_used}/${mem_full} MB" 139 | if which dc > /dev/null 2>&1; then 140 | mempercent="($(echo 100 ${mem_used} \* ${mem_full} / p | dc)%)" 141 | fi 142 | ## DEFINE COLORS 143 | 144 | bold='' 145 | black='' 146 | red='' 147 | green='' 148 | yellow='' 149 | blue='' 150 | magenta='' 151 | cyan='' 152 | white='' 153 | grey='' 154 | reset='' 155 | 156 | ## USER VARIABLES -- YOU CAN CHANGE THESE 157 | 158 | lc="${reset}${bold}${magenta}" # labels 159 | nc="${reset}${bold}${yellow}" # user 160 | hn="${reset}${bold}${blue}" # hostname 161 | ic="${reset}${green}" # info 162 | c0="${reset}${blue}" # first color 163 | c1="${reset}${white}" # second color 164 | c2="${reset}${yellow}" # third color 165 | 166 | cat </dev/null 16 | mkdir -p ~/.config/nvim 17 | printf "${G}Cloning repo...${E}\n" 18 | sleep 2 19 | git clone --depth 1 https://github.com/tamton-aquib/nvim.git ~/.config/nvim 2>/dev/null 20 | nvim +PackerSync 21 | -------------------------------------------------------------------------------- /bash/vim_install_old.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | R="\033[91m" 4 | G="\033[92m" 5 | E="\033[0m" 6 | 7 | read -p "Which vim are you using? [vim/nvim]: " VIM_VERSION 8 | 9 | #### VIM #### 10 | if [[ "$VIM_VERSION" == "vim" ]]; then 11 | curl -s -Lo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 12 | curl -s "https://raw.githubusercontent.com/tamton-aquib/dotfiles/main/.vimrc" > ~/.vimrc 13 | vim -c ":PlugInstall" 14 | echo "colorscheme onedark" >> ~/.vimrc 15 | 16 | #### NVIM #### 17 | elif [[ "$VIM_VERSION" == "nvim" ]]; then 18 | read -p "VimL config or lua [viml/lua]: " VIM_OR_LUA 19 | if [[ "$VIM_OR_LUA" == "vim" ]]; then 20 | curl -s -Lo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 21 | mkdir -p ~/.config/nvim 22 | curl -s "https://raw.githubusercontent.com/tamton-aquib/dotfiles/main/.vimrc" > ~/.config/nvim/init.vim 23 | nvim -c "echo 'Installing Plugins (Usually takes around 30s.)' | :PlugInstall" 24 | echo "colorscheme onedark" >> ~/.config/nvim/init.vim 25 | else 26 | curl -sL git.io/tajvim | bash 27 | fi 28 | else 29 | echo -e "${R}Enter valid vim version.${E}" 30 | fi 31 | -------------------------------------------------------------------------------- /bash/wifi.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | 3 | nmcli radio wifi on 4 | sleep 1 5 | wifi_name=$(nmcli device wifi list | tail -n +2 | fzf) 6 | SSID=$(echo "$wifi_name" | grep -oP "([A-F0-9]{2}:){5}[A-F0-9]{2}") 7 | 8 | nmcli device wifi connect --ask $SSID 9 | -------------------------------------------------------------------------------- /dwmscripts/autostart: -------------------------------------------------------------------------------- 1 | 2 | feh --bg-scale ~/Pictures/aesthetic.png 3 | 4 | picom -f 5 | -------------------------------------------------------------------------------- /dwmscripts/draw_terminal: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | slop=$(slop -f "%x %y %w %h %g %i") || exit 1 3 | read -r X Y W H G ID < <(echo $slop) 4 | 5 | (( W /= 9 )) 6 | (( H /= 19 )) 7 | 8 | alacritty -o window.dimensions.columns=$W, window.dimensions.lines=$H, window.position.x=$X, window.position.y=$Y 9 | # NICE="window.position.x=$X,window.position.y=$Y,window.dimensions.columns=$W,window.dimensions.lines=$H" 10 | # alacritty -o $NICE 11 | -------------------------------------------------------------------------------- /dwmscripts/dwmbar: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | get_datetime() { 4 | date +" %a %d-%b %I:%M %p" 5 | } 6 | 7 | get_status() { 8 | echo "$(get_datetime)"; 9 | } 10 | 11 | get_volume() { 12 | echo $(amixer get Master | grep "Right" | grep -Po "\[[0-9]{2,3}%\]") 13 | } 14 | 15 | get_wifi_name() { 16 | echo $(nmcli d wifi list | grep -P "\*" | awk '{print $3}') 17 | } 18 | 19 | get_net_state() { 20 | STATE=$(cat /sys/class/net/wlp2s0/operstate) 21 | if [ $STATE == "up" ] 22 | then 23 | printf " " 24 | else 25 | printf "睊" 26 | fi 27 | } 28 | 29 | while true 30 | do 31 | STATUS=" $(get_wifi_name) $(get_net_state) ┃  $(get_volume) ┃ $(get_status) " 32 | xsetroot -name "$STATUS" 33 | sleep 1m; 34 | done & 35 | -------------------------------------------------------------------------------- /dwmscripts/volume: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$1" == "up" ]] 4 | then 5 | amixer set Master 10%+ 2>/dev/null 6 | elif [[ "$1" == "down" ]] 7 | then 8 | amixer set Master 10%- 2>/dev/null 9 | fi 10 | -------------------------------------------------------------------------------- /python/colors.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import pyautogui as pog 3 | import pyperclip 4 | from tkinter import Tk,Label,Button 5 | 6 | root = Tk() 7 | label = Label(root, text="Click to copy the color").pack() 8 | 9 | x, y = pog.position() 10 | r, g, b = pog.pixel(x, y) 11 | 12 | rgb_color = f"({r},{g},{b})" 13 | hex_color = f"#{r:02x}{g:02x}{b:02x}" 14 | hex_color_upper = hex_color.upper() 15 | 16 | def noice(color_code): 17 | """noice""" 18 | pyperclip.copy(color_code) 19 | root.destroy() 20 | 21 | color_frame = Label(root, text=" ", bg=hex_color, width=10, height=2).pack() 22 | btn1 = Button(root, text=rgb_color, width=15, command = lambda: noice(rgb_color)).pack() 23 | btn1 = Button(root, text=hex_color, width=15, command = lambda: noice(hex_color)).pack() 24 | btn3 = Button(root, text=hex_color_upper, width=15, command = lambda: noice(hex_color_upper)).pack() 25 | 26 | root.mainloop() 27 | -------------------------------------------------------------------------------- /python/gh.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import requests, sys 3 | 4 | def follow(): 5 | def get_followers(): 6 | url = f"https://api.github.com/users/{username}/followers?per_page=100" 7 | users = requests.get(url).json() 8 | return set(user['login'] for user in users) 9 | 10 | def get_following(): 11 | url = f"https://api.github.com/users/{username}/following?per_page=100" 12 | users = requests.get(url).json() 13 | return set(user['login'] for user in users) 14 | 15 | followers = get_followers() 16 | following = get_following() 17 | dont_follow_you = "\n".join(following - followers) 18 | you_dont_follow = "\n".join(followers - following) 19 | 20 | print(f""" 21 | =============== 22 | You Dont Follow: 23 | =============== 24 | {you_dont_follow} 25 | 26 | =============== 27 | Dont Follow You: 28 | =============== 29 | {dont_follow_you} 30 | """) 31 | 32 | def issues(): 33 | repos = requests.get(f"https://api.github.com/users/{username}/repos").json() 34 | 35 | issues = [] 36 | 37 | for repo in repos: 38 | name = repo["name"] 39 | open_issues = repo["open_issues"] # open_issues_count 40 | if open_issues > 0: 41 | issues.append(f" ({open_issues}) {name}") 42 | 43 | print("- Issues/PRs -") 44 | print("\n".join(issues)) 45 | 46 | def stars(): 47 | repos = requests.get("https://api.github.com/users/tamton-aquib/repos").json() 48 | print(sum([repo['stargazers_count'] for repo in repos])) 49 | 50 | _, command, *username = sys.argv 51 | if not command: print("Enter a command. (issues/follow)"); sys.exit(1) 52 | username = username[0] if len(username)>0 else input("Enter username: ").strip() 53 | 54 | {'issues': issues, 'follow': follow, 'pr': issues, 'stars': stars}[command]() 55 | -------------------------------------------------------------------------------- /python/spam.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import pyautogui as pog 4 | import sys, time 5 | 6 | words = "nice" if len(sys.argv) <= 2 else sys.argv[1] 7 | 8 | time.sleep(3) 9 | 10 | for i in range(3 if len(sys.argv) <= 3 else int(sys.argv[2])): 11 | pog.write(words) 12 | pog.press("enter") 13 | time.sleep(0.5) 14 | -------------------------------------------------------------------------------- /python/telegram_bot.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # TODO: maybe an up command 3 | import os 4 | import telebot 5 | from telebot.types import Message 6 | from time import sleep 7 | import requests 8 | 9 | bot = telebot.TeleBot(os.environ['TELOXIDE_TOKEN'], parse_mode=None) 10 | 11 | users = [] 12 | def usage(): 13 | help_str = "Usage example:\n\n" 14 | help_str += "1./start https://github.com 30\n(sends request each 30 seconds)\n\n" 15 | help_str += "2./start https://github.com\n (sends request each 30 secs by default)" 16 | return help_str 17 | 18 | 19 | @bot.message_handler(commands=['help']) 20 | def send_help(message: Message): 21 | bot.reply_to(message, usage(), disable_web_page_preview=True) 22 | 23 | 24 | @bot.message_handler(commands=['count', 'length', 'len']) 25 | def number_of_users(message: Message): 26 | bot.reply_to(message, f"Number of users: {len(users)}") 27 | 28 | @bot.message_handler(commands=['start', 'up']) 29 | def start_checking(message: Message): 30 | site = message.text.split() 31 | 32 | if len(site) <= 1: 33 | bot.reply_to(message, usage(), disable_web_page_preview=True) 34 | return 35 | else: 36 | timeout = int(site[2]) if len(site) == 3 else 30 37 | site = site[1] 38 | 39 | if message.from_user.id in users: 40 | bot.reply_to(message, "Already subscribed! BruhBot will notify if the site is down!") 41 | return 42 | else: 43 | users.append(message.from_user.id) 44 | 45 | bot.reply_to(message, f"Subscribed to the page!\nYou will be notified when the site goes down!") 46 | 47 | try: 48 | if requests.get(site).status_code != 200: 49 | bot.reply_to(message, "Site Down") 50 | users.clear() 51 | return 52 | except: 53 | bot.reply_to(message, "The provided site does not exist!") 54 | users.remove(message.from_user.id) 55 | return 56 | 57 | while 1: 58 | sleep(timeout) 59 | code: int = requests.get(site).status_code 60 | 61 | if code != 200: 62 | bot.reply_to(message, "Danger!!! Site down!!!") 63 | users.clear() 64 | 65 | print("Starting the bot!") 66 | bot.infinity_polling() 67 | -------------------------------------------------------------------------------- /python/translate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import googletrans 3 | from tkinter import Tk, Label, Button 4 | 5 | root = Tk() 6 | root.geometry('640x400+320+180') 7 | 8 | sentence = root.clipboard_get() 9 | 10 | translator = googletrans.Translator() 11 | nice = translator.translate(sentence) 12 | 13 | for i in range(5): 14 | Label(root, text=f" ").pack() 15 | 16 | Label(root, text=f"From: {nice.src}").pack() 17 | Label(root, text=f"To : {nice.dest}").pack() 18 | Label(root, text=f"Translation: {nice.text}").pack() 19 | 20 | close_button = Button(root, text="close", command=root.destroy).pack() 21 | 22 | root.mainloop() 23 | -------------------------------------------------------------------------------- /python/unicode_arrows.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from bs4 import BeautifulSoup 3 | import requests 4 | 5 | sauce = requests.get('https://unicode-table.com/en/sets/arrow-symbols/#right-arrows').text 6 | soup = BeautifulSoup(sauce, 'lxml') 7 | 8 | a_tag = soup.find_all('a') 9 | 10 | for a in a_tag: 11 | try: 12 | print(a['data-symbol'], end=' ') 13 | except KeyError: 14 | pass 15 | -------------------------------------------------------------------------------- /python/vim_startup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import subprocess as sub 3 | import os 4 | import re 5 | # NOTE: This is not working quite as expected as the `-q` just after startup behaves differently. 6 | # NOTE: a lot has changed in neovim so this might not work exactly 7 | # FIX: this script is old as neovim 0.3 so wont work anymore 8 | 9 | def check_vimlog(): 10 | if 'vim.log' in os.listdir('.'): 11 | sub.run('rm vim.log'.split()) 12 | 13 | def prettify_result(time, plugs_total): 14 | color = "\033[31m" if time > 200 else "\033[32m" 15 | END = "\033[0m" 16 | print("=========================") 17 | print(f"{color}{str(round(time, 2)).center(23)}{END}") 18 | print("=========================") 19 | print(plugs_total) 20 | 21 | def get_file_contents(): 22 | lines = [line for line in open('vim.log', 'r').read().split('\n') if line and 'clock' not in line] 23 | sorted_list = sorted(lines, key = lambda x: x.split()[1], reverse=True)[:40] 24 | total_time = 0 25 | plugs_total = "" 26 | 27 | for item in sorted_list: 28 | item_time = item.split()[1] 29 | item_name = "".join(item.split()[2:]) 30 | try: 31 | item_time = float(item_time[:-1]) if item_time.endswith(':') else float(item_time) 32 | total_time += item_time 33 | except: continue 34 | if 'packer' in item_name: 35 | plug_name = re.findall(r"packer/start/(.+?)/.+?/", item_name) 36 | plug_name = plug_name[0] if plug_name else "packer_compiled.vim" 37 | plugs_total += f"{str(item_time).ljust(8)} : {plug_name}\n" 38 | 39 | prettify_result(total_time, plugs_total) 40 | 41 | if __name__ == '__main__': 42 | check_vimlog() 43 | sub.run(['nvim', '--startuptime', 'vim.log', '-f', '-c', 'q']) 44 | get_file_contents() 45 | check_vimlog() 46 | 47 | --------------------------------------------------------------------------------