Last active
June 30, 2023 22:48
-
-
Save uyriq/f1dfffd635f48ebda3f040347c470ac6 to your computer and use it in GitHub Desktop.
function to run code-insiders quick way ; function to count LOCs ; function to find code in files; TODO NO_PUBKEY fix code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# basta to tedious work to type more then 3 char when run up code editor! | |
function cod () | |
{ | |
pathargument=$1 | |
command -v code-insiders >/dev/null 2>&1 || { | |
echo >&2 "require code-insiders (https://packages.microsoft.com/repos) tool, but it's not installed. Aborting." | |
cat <<EOF | |
could be installed this way: | |
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg | |
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ | |
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' | |
sudo apt install apt-transport-https | |
sudo apt update | |
sudo apt install code-insiders # | |
EOF | |
exit 1 | |
} | |
if [ $# -eq 0 ]; then | |
echo -e "just run in cur.dir. `pwd`" | |
nohup code-insiders . &> /dev/null | |
fi | |
if [ $# -gt 0 ]; then | |
echo -e "path is $pathargument" | |
nohup code-insiders $pathargument &> /dev/null | |
exit 0 | |
fi | |
} | |
function findcode (){ | |
ESCAPE=$'\e' | |
cat <<EOF | |
usage: ${ESCAPE}[0;32mfindcode <path> and [pattern] to search for... path is optional and pattern is reqrd option${ESCAPE}[0m | |
EOF | |
argument1=$1 | |
argument2=$2 | |
if [ $# -eq 0 ]; then | |
echo -e "No path supplied, and no pattern to search supplied, exit \n" | |
fi | |
if [ $# -eq 1 ]; then | |
echo "No path supplied, so doing search in curdir\n" | |
grep --exclude-dir=node_modules --exclude-dir=chunks --exclude-dir=cache -rnw '.' -e $argument1 | |
fi | |
if [ $# -gt 1 ]; then | |
cat <<EOF | |
Path is supplied, so doing search in "$argument1" for "$argument2" | |
EOF | |
grep --exclude-dir=node_modules --exclude-dir=chunks --exclude-dir=cache -rnw "$argument1" -e "$argument2" | |
fi | |
} | |
function music_url() { | |
# Check if mpv is installed | |
if ! command -v mpv &> /dev/null; then | |
echo "Error: mpv is not installed. Please install it and try again." | |
return 1 | |
fi | |
# Check if yt-dlp is installed | |
if ! command -v yt-dlp &> /dev/null; then | |
echo "Error: yt-dlp is not installed. Please install it and try again." | |
return 1 | |
fi | |
url="$1" | |
if [ $# -eq 0 ]; then | |
echo -e "No url supplied, default track play \n" | |
url='https://youtu.be/iHPqCF3Hv-I' | |
fi | |
a=$(yt-dlp --list-formats $url | grep 'audio only' |awk -F' ' '{s1=$1} END {print s1}') | |
arg="$a $url" | |
echo -e "$arg" ; | |
`mpv --player-operation-mode=pseudo-gui --ytdl-format=$arg` & | |
} | |
# useful on dockerized guests, parent host_ip | |
export HOST_IP=$(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment