Last active
December 30, 2022 01:11
-
-
Save mrmakr/4888c687c5315aa0fe641e9a0849855d to your computer and use it in GitHub Desktop.
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
alias hock="lynx -dump -hiddenlinks=ignore https://www.tvmatchen.nu/widget/5abd8aa48823f/ | iconv -f ISO-8859-1 -t UTF-8 | sed -e '/^[[:space:]]*[[:digit:]]\{1,\}\.[[:space:]]\{1,\}[[:digit:]]\{2\}:[[:digit:]]\{2\}[[:space:]]*$/!b' -e :a -e '$b' -e 'N;/\n.*[^[:space:]]/!ba' -e 's/[[:space:]]*\n[[:space:]]*/ /' | sed 's/\[[^]]*\]//g' | sed -n -e '/Idag/,/\*/p'" | |
alias stop-spotlight="sudo mdutil -a -v -i off" | |
alias start-spotlight="sudo mdutil -a -v -i on" | |
alias gitconf="git config --list --show-origin" | |
alias up="uptime | sed 's/.*up \([^,]*\), .*/\1/'" | |
alias lock="pmset displaysleepnow" | |
alias hidedesc="defaults write com.apple.finder CreateDesktop false; killall Finder" | |
alias showdesc="defaults write com.apple.finder CreateDesktop true; killall Finder" | |
alias hidefiles="defaults write com.apple.finder AppleShowAllFiles NO; killall Finder" | |
alias showfiles="defaults write com.apple.finder AppleShowAllFiles YES; killall Finder" | |
alias nowdate='date +"%d-%m-%Y[%H:%M]"' | |
alias line="printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' ─" | |
alias stop-spotlight="sudo mdutil -a -v -i off" | |
alias start-spotlight="sudo mdutil -a -v -i on" | |
alias batt="pmset -g batt | grep -Eo "\d+%" | cut -d% -f1"; # use battstat insead | |
function wifipw() { | |
if hash wifi-password 2>/dev/null; then | |
wifi-password | |
else | |
printf "\\t install wifi-password? y/n \\n" | |
read REPLY | |
if [[ $REPLY =~ ^[Yy]$ ]]; then | |
brew install wifi-password && wifi-password | |
fi | |
fi | |
} | |
function bup() { | |
brew update && brew upgrade | |
brew upgrade --cask | |
echo -n "Cleanup?" | |
read REPLY | |
if [[ $REPLY =~ ^[Yy]$ ]]; then | |
echo "brew cleanup" | |
brew cleanup -v | |
else | |
echo "nah" | |
fi | |
} | |
function hockey() { | |
if ! command -v lynx &>/dev/null; then | |
printf "missing lynx!\\n installing" | |
brew install lynx | |
exit | |
fi | |
output="$(hock)" | |
if [[ -n $output ]]; then | |
printf "%s\\n" "$output" | |
else | |
printf "No games today …\\n" | |
fi | |
} | |
function cleanimg() { | |
exiftool -all="$@" | |
} | |
function f() { | |
find . -maxdepth 2 -type f -iname "$@" #f '*.pdf' -exec sh -c 'mv -iv "$@" ~/.Trash' {} \+ | |
} | |
function f2() { | |
find . -maxdepth 3 -type f -iname "$@" | |
} | |
function zsh-stats-30() { | |
fc -l 1 | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n30 | |
} | |
function preman() { | |
man -t $@ | open -f -a "Preview" | |
} | |
function cheat() { | |
curl cht.sh/$1 | |
} | |
function mkdirr() { | |
mkdir -pv "$@" && cd "$_" | |
# may use 'take' aswell | |
} | |
function myip() { | |
ext=$( | |
curl -s ifconfig.co | |
echo | |
) | |
curl -s "http://ip-api.com/line/${ext}?fields=city,country,org,isp,regionName" | |
printf "int:\\t" | |
ipconfig getifaddr en0 && printf "ext:\\t$ext\\n" | |
echo "scutil --nwi\\t also check scutil --dns" | |
printf "check scutil:\\t $(scutil --nwi)" | |
} | |
function trash() { | |
command mv -v "$@" ~/.Trash | |
} | |
function weather() { | |
ansiweather -l $1 -a false | cut -d'-' -f1 | cut -c 2- | |
} | |
function mpvytsong() { | |
url="$@" | |
yturl="$(youtube-dl --audio-format best --get-title "ytsearch:$url")" | |
ytthumb="$(youtube-dl --audio-format best --get-thumbnail "ytsearch:$url")" | |
ytdesc="$(youtube-dl --audio-format best --get-description "ytsearch:$url")" | |
if hash terminal-notifier 2>/dev/null; then | |
terminal-notifier -title $yturl -message $ytdesc -sound 'default' -appIcon $ytthumb -contentImage $ytthumb | |
fi | |
if hash alerter 2>/dev/null; then | |
alerter -timeout "10" -title "$yturl" -message "$ytdesc" -sound "default" -appIcon "$ytthumb" | |
else | |
echo "$yturl" | |
line | |
echo "$ytdesc" | |
mpv --ytdl-format=bestaudio ytdl://ytsearch:"$*" | |
fi | |
} | |
#sudo log show --style syslog --last 2d | awk '/Enter/ && /unlockUIBecomesActive/ {print $1 " " $2}' | |
# Ctrl+A or Home: Go to the beginning of the line | |
# |… | |
# | |
# CTRL+E – Move to the end of line | |
# …| | |
# | |
# CTRL+W – Delete the words before the cursor | |
# …<|… | |
# | |
# CTRL+U – Delete all characters before the cursor (Kills backward from point to the beginning of line). | |
# …< | |
# | |
# Ctrl+K – will clear everything from the cursor to the end of the line. | |
# …|< | |
function svtplay-temp() { | |
#url=$(pbpaste) | |
current=$(pwd) | |
tempdir="$HOME/Movies/temp" | |
parentdirtemp=$(dirname "$tempdir") | |
if [ ! -d $tempdir ]; then | |
echo "$tempdir doesn't exists" | |
mkdir -v $tempdir | |
fi | |
echo "tempdir: is $tempdir" | |
svtplay-dl -f -S --all-subtitles --exclude=syntolkat,teckentolkat -o $tempdir "$@" | |
if hash rename 2>/dev/null; then | |
cd $tempdir | |
rename -v 's/\-.{6}.[\-]svtplay//' *.* | |
# rename -v 's/([\-]).*\1svtplay//' *.* svtplay changed their names | |
cd $current | |
else | |
for file in $tempdir/*; do | |
newname=$(echo $file | sed 's/.\{8\}[\-]svtplay//') | |
mv -v $file $newname | |
done | |
fi | |
echo | |
for file in $tempdir/*; do | |
mv -v $file $parentdirtemp | |
done | |
echo | |
echo "returning to pwd - $current" | |
cd $current | |
echo "removing $tempdir if empty..." | |
if [ -z "$(ls -A $tempdir)" ]; then | |
echo "removing $tempdir" | |
rmdir $tempdir | |
else | |
echo "$tempdir not empty - not removed:" | |
echo "$(ls -1A $tempdir | wc -l) files" | |
ls -1A $tempdir | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment