Skip to content

Instantly share code, notes, and snippets.

Nginx weekly reporting w/ GoAccess

Adding hostname to nginx logs

By default nginx's log_format does not contain hostname. Since I serve multiple domains with a single nginx, I want to add hostname to nginx's access logs.

I guess nginx's default log_format is combined which is something like this:

Converting Kobo annotations (.annot file) to plain text

Install

  • Put convert.js into a folder
  • npm i xml2js

Usage

Dump into stdout:

Changing iTerm2 theme on SSH for oh-my-zsh

Put following line into your .zshrc

set_iterm_profile() { echo -e "\033]50;SetProfile=$1\a" }

Put colorssh.zsh file into ~/.oh-my-zsh/custom/ folder.

[
{
"name": "Amsterdam Airport Schiphol",
"description": "Free wifi; network name: Airport_Free_WiFi (1 hour time limit) -- British Airways Lounge password: singapore -- Crown Lounge 52 network name: KLM-Lounge - password (only phones need password): (your name)#KLM\n\nHere's how to unlock airport wireless time limits: (https://foxnomad.com/2014/05/22/unlock-unlimited-wifi-airports-time-restrictions/)\n",
"long": 4.7682744,
"lat": 52.3105386
},
{
"name": "Frankfurt Airport",
"description": "Free wireless extended throughout entire airport. Network name: Frankfurt Airport, Hotspot Telekom - Name and email required. (Password: Internet)",