Programming: The New Rock 'N' Roll
In this post we will set up a super efficient programming environment - on a $10 computer, in just a few short lines of code!
Step 1 - Install tmux, a terminal multiplexer. This will allow us to work in as many simultaneous terminal windows as we need to, just as if we are in a graphical desktop but all from a single text console:
sudo apt install tmux
Begin a session with the "tmux" command. Open a new window with Ctrl-b c and switch between them with Ctrl-b n.
Step 2 - Install leiningen, vim and fireplace (formerly called "foreplay"). They work together with the Clojure programming language, which uses an extremely concise syntax to generate highly optimized Java and Javascript code:
sudo apt install vim
git clone https://github.com/ctford/vim-fireplace-easy.git .vim
ln -s ~/.vim/vimrc.vim ~/.vimrc
vim -c "helptags ~/.vim/bundle/vim-fireplace/doc" -c "q"
(Paste the contents of this file into /bin/lein)
sudo chmod a+x /bin/lein
lein
We now have a complete interactive programming environment! In the next post we'll get started with that... but I think it's time to check our email. We'll use the IMAP protocol to sync a local copy of our gmail inbox and the mu4e plugin to index and view our messages in a text editor:
Step 1 - Install emacs and offlineimap:
sudo apt install emacs25
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
sudo apt install offlineimap
Step 2 - Paste the following text into .offlineimaprc:
[general]
accounts = Gmail
[Account Gmail]
localrepository = Local
remoterepository = Remote
autorefresh = 5
quick = 10
postsynchook = mu index --maildir ~/Maildir
status_backend = sqlite
[Repository Local]
type = Maildir
localfolders = ~/Maildir
[Repository Remote]
type = Gmail
remotehost = imap.gmail.com
remoteuser = username@gmail.com
folderfilter = lambda folder: folder in ['INBOX']
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
Now type "offlineimap". It will connect to your account, prompt you for your password and download your messages, checking again every 5 minutes.
Step 3 - Finally, we use mu4e to let us view them in emacs:
sudo apt install mu4e
Add to .spacemacs configuration file:
(mu4e :variables
mu4e-installation-path "/usr/share/emacs/site-lisp")
Open emacs and view our messages with the command "M-x mu4e".
Check it out, I've got mail! Oooweee!
Comments
Post a Comment