🕹ī¸ Do Something Great! 😄

Tag: website

  • Taking back the internet

    Taking back the internet

    When I look at RyanCollins.org and see that I haven’t updated the site in over two years I realize that something needs to change.

    Almost five years ago I switched from running WordPress to Pelican. WordPress is a blogging program that now powers 30% of the web. Pelican is a geek way of creating and publishing a website that requires less server resources. Unfortunately, this means that while Pelican can create very fast websites, updating and managing the site is a lot harder. So over the past week I switched back to WordPress.

    In the mean time, I’ve been posting education related articles over at Eduk8.me while letting RyanCollins.org fall by the wayside. That is going to change. While I adore posting edtech articles, I also like doing all sorts of geeky things. The new RyanCollins.org will be the home of my ramblings, short bursts of wisdom, and who knows what else.

    Be sure to subscribe to the articles RSS feed and the micro blog RSS feed.

  • Publishing using Sphinx to Github

    I’ve been playing around with Sphinx as a digital publishing tool. It can take multiple files written in reStructuredText (similar to Markdown, which is plain text with minimal markup) and create not only a website, but also PDFs and ePubs (and more, list is on the website). An example is the Sublime Text Unofficial Documentation. If you click on the Read the Docs link in the bottom left of the window, you can see the documentation in other formats.

    Read the Docs will automatically create a website and other files from a Github repository, but you can also publish yourself to Github without using another service. My problem came from an issue with Github ignoring the folder _static, which is where Sphinx puts assets for the website. The solution is simple enough, have a .nojekyll file in the root of the website. The question was how to do that automatically. What I did was add a new target to the Makefile[1]:

    github:
        $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
        touch $(BUILDDIR)/html/.nojekyll
        ghp-import $(BUILDDIR)/html/
        git push -u origin gh-pages
        @echo
        @echo "Published to Github"
    

    Now when I type make github, the website will be rebuilt, a .nojekyll file will be created, the website will be imported into the gh-pages branch and that branch will be pushed to Github.

    [1]: This assumes you have already set up authentication to push a branch to Github and have installed ghp-import.

  • Scheduled posting with Pelican

    After my switch from WordPress to Pelican I realized that there was one feature that I really was missing, the ability to schedule posts in the future. When you have an itch, you scratch it. By using my Linux box at home (you could use an OS X machine also) and Dropbox, I can now schedule posts.

    Prequisites

    On my server I set up Dropbox. There is a script on the Dropbox site that allows you to set it up on headless servers (a server without a monitor, keyboard, or mouse). In my DropBox folder, I created a folder called ToPost.

    The script

    You’ll need to adjust the path to TOPOST and to the SITE.

    #!/bin/bash
    
    TOPOST=~/Dropbox/Elements/RyanCollins.org/ToPost/*.markdown
    SITE=~/Development/ryancollins.org
    
    shopt -s nullglob
    
    YEAR=`date +%Y`
    NOW=`date +"%Y-%m-%d %H:%M"`
    
    for file in ${TOPOST}
    do
        DATELINE=`cat "${file}" | grep "^Date: "`
        if [[ ${DATELINE#* } < ${NOW} ]]; then
            mv "${file}" "${SITE}/content/${YEAR}"
            cd "${SITE}"
            make rsync_upload
        fi
    done
    

    Scheduling

    At the command prompt, run crontab with the -e parameter so we can add a scheduled job:

    ryan@serverbot:~$ crontab -e
    

    and add a line to our script to run it every 15 minutes:

    */15    *   *   *   *    /home/ryan/Development/ryancollins.org/dbupdate.sh