Tools (Programming)

AWS

EC2



Apache (HTTP server)



How Paul set up the web.py server with Apache on Digital Ocean

  1. Remember that the default Apache config file is located at /etc/apache2/apache2.conf, but Paul said you generally don't need to make changes to it.

  2. Instead, because we're using a Ubuntu instance (and Ubuntu is based on Debian), the note at the top of the apache2.conf relates to us when it says that the configuration can be broken into separate files, and that in particular, we can use the option that says IncludeOptional sites-enabled/*.conf

  3. So what he did was to create a /etc/apache2/sites-available/oorklecom.conf file and a /etc/apache2/sites-available/ioorklecom.conf file, and then create symlinks to those files in the /sites-enabled/ folder that had the same names as the original files.

  4. The /sites-available/ folder had a file named 000-default.conf which had these contents:



    1. <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet



  5. He set up the oorklecom.conf file to look like this:



    1. <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. ServerName www.oorkle.com ServerAlias oorkle.com ServerAdmin webmaster@localhost DocumentRoot /var/www/oorkle WSGIDaemonProcess oorklemobile threads=5 WSGIScriptAlias / /var/www/oorkle/oorkle.py Alias /static /var/www/oorkle/static/ # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet



  6. The Web.py WSGI deployment docs mention the WSGIScriptAlias command, and he said that he'd already known about the WSGIDaemonProcess command from having worked with Flask.

    1. More info on WSGIDaemonProcess here.

  7. At that point I assume you can just restart the Apache server with /etc/init.d/apache2 restart (Source)



Docker

Intros

  • ROpenSciLabs.github.io - What is Docker and Why should I use it?

    • This first page of the tutorial was a good quick overview of what Docker is for:

    • In short, you should use Docker because

      • it allows you to wrangle dependencies starting from the operating system up to details such as R and Latex package versions

      • it makes sure that your analyses are reproducible.

      There are a couple of other points what Docker helps with:

      • Portability: Since a Docker container can easily be sent to another machine, you can set up everything on your own computer and then run the analyses on e.g. a more powerful machine.

      • Sharability: You can send the Docker container to anyone (who knows how to work with Docker).

      Basic vocabulary

      The words image and container will come up a lot in the following. An instance of an image is called container. An image is the setup of the virtual computer. If you run this image, you will have an instance of it, which we call containter. You can have many running containers of the same image.

  • Docker - Get Started

    • The difference between a container and a virtual machine:

      • container runs natively on Linux and shares the kernel of the host machine with other containers. It runs a discrete process, taking no more memory than any other executable, making it lightweight.

        By contrast, a virtual machine (VM) runs a full-blown “guest” operating system with virtual access to host resources through a hypervisor. In general, VMs provide an environment with more resources than most applications need.

Important commands

  • docker container ls

  • docker <container_id> exec <command>

  • docker build -t <desired image name> .

  • docker run <image name>

  • docker-machine restart

With Python

Troubleshooting / debugging

HTTPS

Let's Encrypt

Map / Reduce

  • A brief explanation of what map / reduce does: 

NGINX

Tools

Articles

Misc thoughts

  • 2017.03.08 - While troubleshooting nginx for Service Fusion, the config files I needed to look at were in /etc/nginx/. I just searched all of the files at once with a single command to see which of them had the text string I was looking for. It turned out to be in /etc/nginx/sites-enabled/default.

SSH

Pageant

Task / Job queues

Celery

Gearman

Text editors

Neovim

Reviews

Positive

Negative

  • I built a Neovim setup with great autocomplete, amazing file navigation, working debugger, but ended up going back to IntelliJ because:

    • Code completion: Neovim has great completion plugins, and LSP support is good, but IntelliJ is still much better.

      • Is smarter, shows the best matches (matching types, names that seem to make more sense in the context)

      • Works inside most text editing contexts, like debuggers and text editing inside search results.

      • Handles partial imports very well.

      • Works in several different file types. It handles GraphQL, and even HTTP headers (Testing HTTP requests)

      • Even though indexing takes a long time, the index is kept in sync with the filesystem automatically

    • Text Editing features work seamlessly inside search/replace, debugger watches and several other places.

    • Project-wide Local History: yeah I use Git, but it’s great to have an automatic change history so you call revert recent changes. Gives me that peace of mind.

    • Debugger is so much better than anything you can build with Nvim.

    • Search/Replace is miles ahead of Nvim, even if compared to Telescope. I can easily switch search parameters and I can even edit files inside search results. (src)

  • the main thing you'll be missing (no matter the language) is the integration with a debugger. (src)

  • I dropped Neovim for Cursor, Claude 3,5 Sonnet made me much more productive. If I find something as good in the Neovim world, I will switch back (src)

How to learn

  • I wouldn't make the switch unless you've already been using IDEAVim for a few weeks or months. I think it's too much of a switch to learn the new keybindings and plugin ecosystem all at once. IDEAVim is one of the best Vim emulation plugins. (src)

  • it is better to first play around with ideavim setup actions get used to it and then translate that config to nvim (src)

Vim

Tutorials / training

Vimium

Vimium is a Chrome extension that lets you control Google Chrome with vim-like keyboard commands.  It was used by some devs at Infer.

Documentation

How to learn to use Vimium

  1. Memorize the Shift+/ command to open the 'Help' dialog.

  2. Memorize the "f" to select an option on the page.

    • You could have a website where there are a bunch of links that the user needs to select by using this command.

  3. Memorize "b" to open a bookmark.

 

Time-tracking

Chronolapse

  • https://www.chronolapse.com/

  • Use Chronolapse to record your screen.

    • My settings for my dual-monitor set-up:

      • Top: 1919

      • Left: -550

      • Width: 1925

      • Height: 1050

  • I couldn't get Chronolapse to convert the screens to a gif / video (it produced an error), so I used: http://gifmaker.me/

    • I set it to create a gif at 50% of the size.

    • If you do 1 capture per minute, you end up with a ~12mb/hour file.

tmux

tmux lets you access multiple terminal sessions simultaneously in a single window.

Rec'd by

  • Cody

Tutorials