Minimize PNG files using lossy compression

Unlike JPEG, PNG is a lossless image format, which is why it reproduces pictures perfectly, but makes many of them — mostly photographs — much larger than what you’d get with lossy codecs. PNG is also the only way to get pictures with transparency (alpha channel) display in all browsers, so if we need images with alpha channel, we have to use large PNGs. However, there’s a little trick we can use to make them smaller: by applying lossy preprocessing.

Continue reading “Minimize PNG files using lossy compression”

Optimizing JPEG images with MozJPEG

MozJPEG is a project from Mozilla aimed to improve JPEG compression while keeping full backwards compatibility with current decoders. Recently they released version 3 of the library. Previous version reduced files by 5% on average compared to jpeg-turbo, the JPG compression library it is based on. The new version contains more improvements, such as reducing compression artifacts for text on white background, and better quality for high-resolution images.

Continue reading “Optimizing JPEG images with MozJPEG”

Gogs: setting up self-hosted GitHub clone

Forget scripto-Perlo-C porridge to setup a web interface for Git! Forget installing thousands of dependencies to setup your own repository hosting! Gogs is here to make your life easier!

Gogs is a GitHub clone written in Go, which you can host on your own server. It’s a web interface to Git repositories plus a simple bug tracker. Gogs is very easy to install and use.

Continue reading “Gogs: setting up self-hosted GitHub clone”

Bolt — an embedded key/value database for Go

If you want data persistence in your Go application, most likely you’re thinking of using some database. The easiest and probably the most convenient for deployment are embedded databases. There are many wrappers for C databases, however Go developers usually prefer pure Golang solutions.

Bolt is the way to go: it’s a pure Go embedded key/value database, which is easy to use for persistence in your Go projects. Bolt is similar to LMDB, which many consider the best among state-of-the-art modern key-value stores. Just like LMDB, and unlike LevelDB, BoltDB supports fully serializable ACID transactions. Unlike SQLite, it doesn’t have a query language, and is much easier to use for common things.

Bolt saves data into a single memory-mapped file on disk. It doesn’t have a separate journal, write-ahead log, or a thread for compaction or garbage collection: it deals with just one file, and does it safely.

Continue reading “Bolt — an embedded key/value database for Go”

Download web fonts from Google with webfont-dl

If you’re using Google Fonts to improve your website appearance, your visitors are always forced to download the initial CSS file describing fonts from Google’s servers every time they load a page, even though requests to the actual fonts may be cached. This can make your site slower. There are benefits to serving fonts from Google’s servers (for example, Google sends differently hinted fonts for Windows and OS X to improve their readability), however if you want to avoid depending on Google, or to improve load times, you may want to host the fonts yourself.

Continue reading “Download web fonts from Google with webfont-dl”