summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fuz19
-rwxr-xr-xbin/fzsnip4
-rw-r--r--bin/parse_subids.py14
-rwxr-xr-xbin/snippet.py9
4 files changed, 38 insertions, 8 deletions
diff --git a/bin/fuz b/bin/fuz
new file mode 100755
index 0000000..de158c1
--- /dev/null
+++ b/bin/fuz
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -e
+
+main() {
+ previous_file="$1"
+ file_to_edit=`select_file $previous_file`
+
+ if [ -n "$file_to_edit" ] ; then
+ "$EDITOR" "$file_to_edit"
+ main "$file_to_edit"
+ fi
+}
+
+select_file() {
+ given_file="$1"
+ fzf --preview="bat {}" --preview-window=right:70%:wrap --query="$given_file"
+}
+
+main ""
diff --git a/bin/fzsnip b/bin/fzsnip
new file mode 100755
index 0000000..fd50bd1
--- /dev/null
+++ b/bin/fzsnip
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+selected="$(python ~/bin/snippet.py | fzf -e -i )"
+#strip tags and any trailing space before sending to wl-copy
+echo -e "$selected"| sed -e 's/tags\:\.\*\$//;$d' | wl-copy
diff --git a/bin/parse_subids.py b/bin/parse_subids.py
index 5e8b8f2..466c15b 100644
--- a/bin/parse_subids.py
+++ b/bin/parse_subids.py
@@ -1,19 +1,17 @@
from bs4 import BeautifulSoup
import markdown
-
-with open('/home/lxf/writing/wired/bf-photo-deals.txt', 'r') as f:
+with open('/home/lxf/writing/conde/wired/weekend-deals-061320.txt', 'r') as f:
data = f.read()
-result = open('/home/lxf/writing/wired/subid-links.txt', 'a')
+result = open('/home/lxf/writing/conde/wired/subid-links.txt', 'a')
+print(data)
soup = BeautifulSoup(markdown.markdown(data), "lxml")
-subid = "blackfridayphotodeals2019"
-page_url = "https://www.wired.com/story/best-black-friday-photography-deals-2019/"
+subid = "weekenddeals06132020"
+page_url = "https://www.wired.com/story/weekend-deals-june-12-2020"
for a in soup.find_all('a'):
start = a['href'].split('//')[1][:4]
if str(start) == 'best' or start == 'goto':
- l = "%s,,%s,Impact,%s\n" % (page_url, subid, a['href'])
+ l = "%s,%s,%s,Impact,%s\n" % (page_url, subid, a.contents[0], a['href'])
result.write(l)
result.close()
-def parse_links(f):
-
diff --git a/bin/snippet.py b/bin/snippet.py
new file mode 100755
index 0000000..e3acad4
--- /dev/null
+++ b/bin/snippet.py
@@ -0,0 +1,9 @@
+import re
+with open('/home/lxf/documents/textsnippets.txt', 'r') as f:
+ data = f.read()
+snips = re.split("---", data)
+for snip in snips:
+ # strip the blank line at the end
+ s = '\n'.join(snip.split('\n')[1:-1])
+ #make sure we output the newlines, but no strong wrapping single quotes
+ print(repr(s.strip()).strip('\''))