all repos — dotfiles @ 50b6aaff1b300026dbb9057d336732cc11ecf13d

linux dotfiles

add scripts - get memes, reddit-browse
Prithu Goswami prithugoswami524@gmail.com
Mon, 23 Dec 2019 09:59:38 +0530
commit

50b6aaff1b300026dbb9057d336732cc11ecf13d

parent

bb6e837b4d70c8fca17b7d06e945ecce3ddfacd5

2 files changed, 25 insertions(+), 0 deletions(-)

jump to
A bin/scripts/get-memes

@@ -0,0 +1,5 @@

+#!/usr/bin/bash + +memepath=$HOME/pictures/memes + +wget --quiet reddit.com/r/memes.json -O -| jq '.data.children[] |.data.url' | xargs wget --quiet -P "$memepath"
A bin/scripts/reddit-browse

@@ -0,0 +1,20 @@

+#!/usr/bin/bash + +[ -z $1 ] && exit 0 +after="" + +while [ 1 ] +do + if [ "$2" = "top" ] + then + url="reddit.com/r/$1/top.json?t=all&after=$after" + else + url="reddit.com/r/$1.json?after=$after" + fi + wget --quiet -O - "$url" |\ + tee /tmp/rtmp.json | jq '.data.children[] |.data.url' |\ + grep -E 'jpg|png"$' | xargs feh -F + after=$(cat /tmp/rtmp.json | jq '.data.after' | tr -d '"') + printf "continue? [y/n]: "; read ans + [ $ans = "n" ] && exit 0 +done