add more scripts
This commit is contained in:
parent
bee2f07685
commit
d541669ed3
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Generates an index of the connections between items in the zettel.
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
|
||||
base = "/home/nico/vimwiki/zettel/"
|
||||
|
||||
edges = [] # an 'edge' is a tuple of a point and a destination.
|
||||
|
||||
link_regex = re.compile(r'\[\[(.*?)\]\]')
|
||||
|
||||
# search is a function that is called recursively to build the list of reachable files
|
||||
def search(f):
|
||||
if os.path.exists(f) and f.split(".")[1] == "md":
|
||||
fp = open(f,"r")
|
||||
r = fp.read()
|
||||
links = link_regex.findall(r)
|
||||
for l in links: # all files mentioned as links in this one
|
||||
edge = (f, l) # tuple of (src, dest)
|
||||
if not (edge in edges):
|
||||
edges.append(edge)
|
||||
search(os.path.join(base, l))
|
||||
|
||||
search(os.path.join(base,"index.md"))
|
||||
|
||||
with open(os.path.join(base,"index"),"w+") as i:
|
||||
for e in edges:
|
||||
i.write(f"{os.path.basename(e[0])} {e[1]}\n")
|
||||
|
||||
|
|
@ -1,6 +1,12 @@
|
|||
#!/bin/sh
|
||||
case "${1%%:*}" in
|
||||
http|https)
|
||||
case $1 in
|
||||
*youtube.com*)
|
||||
mpv --ytdl-format='bestvideo[height<=1080]+bestaudio' $1
|
||||
;;
|
||||
*mp3)
|
||||
mpv "$1"
|
||||
;;
|
||||
http://*|https://*)
|
||||
if [ $(cat /etc/hostname) = 'alarm' ]
|
||||
then
|
||||
exec firefox "$1"
|
||||
|
@ -8,16 +14,23 @@ case "${1%%:*}" in
|
|||
exec qutebrowser "$1"
|
||||
fi
|
||||
;;
|
||||
gemini)
|
||||
gemini://*)
|
||||
exec termite -e "amfora $1"
|
||||
;;
|
||||
mailto)
|
||||
mailto://*)
|
||||
exec thunderbird "$1"
|
||||
;;
|
||||
*.pdf)
|
||||
exec evince "$1"
|
||||
;;
|
||||
*)
|
||||
*.txt)
|
||||
exec gedit "$1"
|
||||
;;
|
||||
*/)
|
||||
exec Thunar "$1"
|
||||
;;
|
||||
*)
|
||||
notify-send "no handler for $1, using system xdg"
|
||||
exec /usr/bin/xdg-open "$@"
|
||||
;;
|
||||
esac
|
||||
|
|
Reference in New Issue