Programming Blog

Programming related articles.

Use python as a Simple HTTP Server

The other day, I needed to share files with a Windows based computer. I did not have any ftp nor samba server installed on my machine. For some reason ssh did not work either. As a quick solution, I decided to use a trick I saw some time ago. I started a python process which works as a simple HTTP server. Next, I opened a browser on remote machine and connected to my HTTP server and downloaded the files through HTTP.

Emacs setup for web development

This is the follow up for basic emacs setup post. In this post I will explain how to update your emacs setup for web development. I will cover

Emacs setup for python development

This is the follow up for basic emacs setup post. In this post I will explain how to update your emacs setup for python development. I will cover

  • pymacs (Python binding for emacs. This is a ropemacs dependency)
  • rope (Python refactoring library)
  • ropemacs (Rope bindings for emacs)
  • rope-mode (Minor mode for ropemacs)
  • pyflakes (passive checker of Python programs)
  • flymake (an on-the-fly syntax checker for GNU Emacs)
  • flymake-mode (Minor mode for flymake)
  • pyflakes error format script
  • autocomplete rope integration

Basic emacs setup

Emacs is a great editor. But it is really hard to set it up. So I decided to write a document for my current emacs setup. In this post, I will explain how to install emacs with a basic setup.

I will cover how to:

  • Install emacs
  • Enable IDO mode
  • Add autocomplete mode
  • Add yasnippet mode
  • Set window title to full file name
  • Install color themes

curl tutorial with examples of usage

Curl is a linux utility that is used to make HTTP requests to a given url. It outputs HTTP response to standard output and is actually very easy to use. Here are some examples to show its usage...

Pretty printing JSON output in terminal

If you need to pretty print the json output of a terminal command (so you can inspect it more easily), you can use python's json module. I usually use it to pretty print the output of curl command. Here is an example

    :::bash
    curl http://somesite.com/my/json/ | python -m json.tool

This utility can also be used to pretty print json files like following

    :::bash
    python -m json.tool minified.json > prettyprint.json