mirror of
https://codeberg.org/hyperreal/dotfiles
synced 2024-11-25 11:53:43 +01:00
49 lines
992 B
Bash
49 lines
992 B
Bash
|
#!/usr/bin/env zsh
|
||
|
##############################################################################
|
||
|
# vim:set ft=zsh ai et sw=4 ts=4:
|
||
|
#
|
||
|
# @author : Jeffrey Serio <hyperreal@unixcat.coffee>
|
||
|
# @file : functions.zsh
|
||
|
# @load_order : post-zshrc
|
||
|
|
||
|
|
||
|
## Do an ls after cd
|
||
|
cd() { builtin cd "$@" && ls; }
|
||
|
|
||
|
## Create new directory and enter it
|
||
|
mkd() { mkdir -p "$@" && cd "$_"; }
|
||
|
|
||
|
## pids
|
||
|
pids() { pgrep -a "$@"; }
|
||
|
|
||
|
## variation of our manzsh() function; pick you poison:
|
||
|
manzsh() { /usr/bin/man zshall | most +/"$1" ; }
|
||
|
|
||
|
## restart zsh
|
||
|
restart () {
|
||
|
exec $SHELL $SHELL_ARGS "$@"
|
||
|
}
|
||
|
|
||
|
rsrc() { cd && clear && restart; }
|
||
|
|
||
|
## parse HackerNews feed (https://hnrss.org/newest)
|
||
|
hn() {
|
||
|
python3 <(cat <<EOF
|
||
|
|
||
|
import feedparser
|
||
|
HNFeed = feedparser.parse("https://hnrss.org/newest")
|
||
|
|
||
|
class bcolors:
|
||
|
HEADER = '\033[95m'
|
||
|
ENDC = '\033[0m'
|
||
|
|
||
|
for item in HNFeed.entries:
|
||
|
print(f"{bcolors.HEADER}%s{bcolors.ENDC}" % item.title)
|
||
|
print(item.links[0].href)
|
||
|
print("")
|
||
|
|
||
|
EOF
|
||
|
) | bat -p
|
||
|
}
|
||
|
|