Category: Productivity

Building Docker image on Raspberry Pi 3 with Ubuntu 16.04

Building Docker image on Raspberry Pi 3 with Ubuntu 16.04

When trying to build docker images using my raspberry pi 3, running Ubuntu Core 16.04, I kept getting following error:

error checking context: 'can't stat '/home/rajatjindal83/dockerfiles''.

My Dockerfile was pretty simple, so it was confusing what could be wrong.

FROM armhf/ubuntu
RUN apt-get update && apt-get -qy install git nano curl wget build-essential

I tried searching on Google, but couldn’t find anything that will fix this issue. When I couldn’t find any tried and tested solution, I started to think from a software engineering perspective of what could be causing this issue.

Apparently, Ubuntu Core use Snaps for installing packages, and by default Snaps cannot access ‘stuff’ they are not suppose to. and using same principle Docker (which is just another Snap package) didn’t had access to touch my home directory.

To fix this, I had to run following command:

snap connect docker:home core:home

References:
stack-over-flow
Snap Interfaces

Once I did this, I was able to successfully build my Docker image:

root@localhost:~/dockerfiles# docker build .
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM armhf/ubuntu ---> fa40ea71de37
Step 2/2 : RUN apt-get update && apt-get -qy install git nano curl wget build-essential --->
 Using cache ---> eef28b5573c8
Successfully built eef28b5573c8
root@localhost:~/dockerfiles#
Write WordPress posts on the go using WordPress mobile app

Write WordPress posts on the go using WordPress mobile app

If you are like me who like to spend a lot of time browsing on your mobile phone, you are gonna love this app.

Recently i came across WordPress app on app-store. Having used a similar app earlier, I was not very hopeful but oh boy, I was surprised.

The super easy interface for this app totally blowed me away AND you can use it to manage any of your WordPress site. Thats right, it does not have to be hosted by WordPress.

Search for WordPress in AppStore and install it 


Open the app and click on login button


Click on “Log into your site …”


Enter the base url of your WordPress website


Enter username and password


If successful, it will show your profile as well as site will be added successfully


If you click on your site, it will take you to a nice interface where you can manage your posts, pages, media etc. pretty much everything !!


Once you click on posts, you can click at top dropdown to toggle between published or draft or scheduled or trashed posts. You can add new posts or edit existing one’s. This is pretty amazing

Once done editing you can add tags to the post or publish it right from your mobile phone


Try it out and let us know what you think about this cool app

how to use code syntax highlighter in wordpress

how to use code syntax highlighter in wordpress

One of the thing that you absolutely need for a technical blog is to have some kind of syntax highlighter to make code examples easy to read.

When i started this blog, in my first blog itself i started missing syntax highlighter.

I started to search for one. Following was my selection criteria:

  • Has to support multiple languages
  • Should be easy to setup
  • Should be easy for me to highlight code with just css class

I tried to install a few wordpress plugin but none worked per my expectation.

So i started to search for highlighter which does not have to be a wordpress plugin and i found highlight.js which looked promising And it worked perfectly fine when i tried it for few languages:

  • YAML
  • Dockerfile
  • Go lang

For embedding this with my WordPress installation i had to modify header.php file as follows:

<link rel="stylesheet" href="https://rajatjindal.com/highlight-js/styles/default.css">
<script src="https://rajatjindal.com/highlight-js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

Once i did this, highlighting code was as easy as follows:

<pre><code class="yaml">---
kind: Service
apiVersion: v1
metadata:
  labels:
    k8s-app: k8s-awesome-service</code></pre>

which will be displayed as follows:

---
kind: Service
apiVersion: v1
metadata:
  labels:
    k8s-app: k8s-awesome-service

I do plan to use this extensively for other programming languages as i learn and write more.

I will update the post after a few weeks as i use it more