Using s3cmd to synchronize local files against an S3 bucket

I use the following command to synchronize a local directory in a web project containing static resources with an S3 bucket. s3cmd \ –ssl \ –skip-existing \ –recursive \ –delete-removed \ –no-preserve \ –guess-mime-type \ –add-header=Expires:2037-12-31T00:00:00Z \ –add-header=Cache-Control:max-age=155520000,public \ –encoding=UTF-8 \ sync ./src/main/webapp/static/ s3://bucketname HTTP response headers are defined per-file rather than per-bucket, and therefore [...]

Setting up Amazon S3 to host static media assets

I have a server with many gigabytes of static images that are starting to consume all of its available disk space. Unfortunately, the server is underpowered and not regularly backed up, which means that requests are not served as quickly as they could be and a system failure means I could lose all of this [...]

Apache httpd + mod_jk Configuration for a 503 “Down for Maintenance” Page

This is a configuration I used to create a “Down for Maintenance” page with a 503 HTTP response code in httpd while I redeploy a Tomcat war file. 1. JkUnMount a static resource Since I have a dedicated server, my mod_jk configuration directs all traffic to Tomcat. In order to have Apache serve a static [...]

Live template in IntelliJ IDEA to generate static class-level Logger variable

This reduces the keystrokes needed to introduce a logger variable in your class to simply typing ‘log’ and pressing [Tab] in the declaration block of your class. Head over to Project Settings > Live Templates and then add a new template to the ‘plain’ group. Assign the following values: abbreviation: log description: private static final [...]

Python + peewee and OperationalError ‘MySQL server has gone away’

It took hours to figure out why my python script using peewee yielded OperationalError(2006, ‘MySQL server has gone away’), but I found the problem. This error is very misleading and also results when MySQL responds with a Packet Too Large response on an INSERT statement. In my case, I’m inserting a very large 15-20 MB [...]

Configuring Eclipse for IntelliJ users

There are a few things I’ve gotten used to in IntelliJ that require some customizations in Eclipse. The following steps will make Eclipse feel more familiar and ease the transition. Key Bindings You can get close to IntelliJ’s key bindings by installing the ideakeyscheme plugin. Place the downloaded JAR in eclipse/dropins and unzip it into [...]

MacOS Application Installation List

This is a list of applications I find useful on a Mac. KeePassX Chrome Firefox iTerm Flux: I use 3000K for the sunset setting. smcFanControl Degrees Sublime Text PyCharm FileZilla Android File Transfer LibreOffice Google Drive JDK 7 JDK 8 Maven Git Homebrew IntelliJ PyCharm Xcode Also developer command-line tools via xcode-select –install Chmox VirtualBox

Sublime Text Key Mappings for MacOS

This is my Sublime Text custom key configuration on MacOS, which makes it a bit more consistent with other text editors. Open Preferences > Key Bindings – User and paste the following. [ // Reference: // http://docs.sublimetext.info/en/sublime-text-2/reference/commands.html {"keys": ["end"], “command”: “move_to”, “args”: {“to”: “eol”}}, {“keys”: ["home"], “command”: “move_to”, “args”: {“to”: “bol”}}, {“keys”: ["super+home"], “command”: “move_to”, [...]

IntelliJ Keymap Customizations on MacOS

A few useful IntelliJ customizations on MacOS. Tab Navigation Some of the tab navigation would be better if it’s consistent with other text editors on MacOS. Go to: Project Settings > Keymap > Main menu > Window > Editor Tabs Under this list, add the following keyboard shortcuts. The existing shortcuts should also be kept. [...]

Configuring Python on MacOS

This post goes through the steps to add the necessary modules in Python that I use. Install pip $ sudo easy_install pip Set up MySQL prerequisites to install the Python MySQLdb module mysql_config must be on the path in order to install the MySQL-python module. I install MySQL in /usr/local and then create a symlink [...]