Skip to content

Instantly share code, notes, and snippets.

@MellonQ MellonQ/
Last active Aug 29, 2015

What would you like to do?
#! /bin/bash
# Requirements:
# - CLI tool for google services.
# - lightweight and flexible command-line JSON processor
# Change dir to stored messages. Use
cd ~/UserName/
# Make some dirs
mkdir /tmp/j2b.posts/
mkdir /tmp/j2b.trash
for i in $(ls -1 | sort -ug); do
echo "$i:"
jq -r ".[0]|.timestamp,.tags,.body" "$i"
echo "~~~~~~~~~~~~"
echo "Do you want to post this shit?"
read k
if [ -n "$k" ]; then
echo "K, let me to post it."
TMPFILE="$(mktemp -p /tmp/ j2b.XXXX)"
jq -r -M '.[0]|.body' "$i" > "$TMPFILE"
google blogger post --title "$(jq -r -M '.[0]|.timestamp' $i)" --tag "$(jq -c -M '.[0]|.tags' $i | sed s/'\['// | sed s/'\]'// | sed s/'"'//g)" "$TMPFILE"
mv "$i" /tmp/j2b.posts/
echo "Yay! World is so wonderful without your shit!"
mv "$i" /tmp/j2b.trash
echo "================================================"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.