Skip to content

Instantly share code, notes, and snippets.

@gazs
Created August 22, 2013 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gazs/6305440 to your computer and use it in GitHub Desktop.
Save gazs/6305440 to your computer and use it in GitHub Desktop.
#!/bin/bash
# not really sure @ https://github.com/mroth/lolcommits/issues/62
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
fi
source ".rvmrc"
lolcommits --capture
# --- kinja stuff ---
#blogid=38899 # whencreating.kinja
blogid=493107435 #gazs.kinja
authorid=493107433 #gazs
#token=$(sh ./get_superuser.sh)
token=$(sqlite3 ~/Library/Application\ Support/Google/Chrome/Default/Cookies 'select value from cookies where name="KinjaToken" order by last_access_utc desc limit 1;')
file=$(ls -ltm1 ~/.lolcommits/kinja-mantle/*.jpg | head -1)
#imageurl=$(http -f POST kinja.com/api/image/upload images[]@$file | jq '.files[0].url')
imageurl=$(curl -F images=@$file kinja.com/api/image/upload | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["files"][0]["url"]')
#http -f POST gazs.kinja.com/api/post/add\?token=$token defaultBlogId=$blogid entry=$imageurl headline="" meta.status="PUBLISHED"
curl -d "meta.status=PUBLISHED&headline=''&defaultBlogId=$blogid&entry=$imageurl" "http://gazs.kinja.com/api/post/add?token=$token"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment