• Skip to primary navigation
  • Skip to main content
Ethan Banks

Ethan Banks

@ecbanks

  • Blog
  • Book
  • Podcasts
  • RSS
  • Show Search
Hide Search

Hands On

How To Use Grep + Regex To Match Non-200 HTTP Status Codes In Apache Server Logs

Ethan Banks · 3 minutes to read
Published April 6, 2022 · Updated April 7, 2022

Let’s say you want to see the requests Apache is upset about. How do you filter the logs to see every entry that doesn’t have a status code in the 200s? Depending on your Apache LogFormat, you could try…

sudo grep -E ‘\” [1345][01235][0-9] [[:digit:]]{1,8} \”‘ /var/log/apache2/access.log

How To Fix Ubuntu 18.04 ‘apt update’ Throwing An NGINX Repository i386 Package Error

Ethan Banks · < 1 minute to read
Published March 22, 2022 · Updated April 6, 2022

If ‘apt update’ on Ubuntu 18.04 throws an error N: Skipping acquire of configured file ‘nginx/binary-i386/Packages’ as repository ‘http://nginx.org/packages/ubuntu bionic InRelease’ doesn’t support architecture ‘i386’, then replace the one line of text in /etc/apt/sources.list.d/nginx.list with this line instead.

deb [arch=amd64] http://nginx.org/packages/mainline/ubuntu/ bionic nginx

How To Create A Python Function You Can Call From Other Scripts

Ethan Banks · 4 minutes to read
Published March 8, 2022 · Updated March 8, 2022

Writing and calling functions is a key component of the Don’t Repeat Yourself (DRY) principle of software development. Creating a function in a single script and calling that function from other scripts is preferable to performing copypasta of the same bit of code throughout several scripts. When a function lives in a single script, it only needs to be updated in that one place when it inevitably needs updating.

How To Blackhole (Null Route) An IPv6 Block On Linux Using ‘ip -6 route’

Ethan Banks · 3 minutes to read
Published March 1, 2022 · Updated April 6, 2022

If you wanted to drop traffic at your Linux host destined for, let’s say, IPv6 netblock 2a09:8700:1::/48, you could get that done with this command.

sudo ip -6 route add blackhole 2a09:8700:1::/48

What Does An ‘R’ Before A String Mean In Python?

Ethan Banks · < 1 minute to read
Published February 25, 2022 · Updated February 23, 2022

An ‘r’ before a string tells the Python interpreter to treat backslashes as a literal (raw) character. Normally, Python uses backslashes as escape characters.

How To Pass Environment Variables To A Remote SSH Deployment With PyCharm

Ethan Banks · 3 minutes to read
Published February 16, 2022 · Updated February 16, 2022

PyCharm allows for the passing of environment variables from the IDE to a script, whether that script is running locally or in a remote SSH deployment you’ve configured for your project. To set the environment variables, select Edit Configurations from the Run menu.

How To Pass API Query Parameters In A Curl Request

Ethan Banks · < 1 minute to read
Published February 7, 2022 · Updated February 7, 2022

Why does adding a query parameter on the end of a curl request against an API endpoint result in an error? Because you need -G and -d, that’s why.

How Upgrading PHP On WordPress Became *It Was DNS*-An IT Operations Tale

Ethan Banks · 6 minutes to read
Published May 19, 2021 · Updated May 19, 2021

Most of the search engine hits for “upgrade PHP on WordPress” told me to go into CPanel or a similar tool my hosting provider might offer to abstract what’s going on with the server itself. That’s not what I was looking for, because I manage my own hosts. I needed to know how to reconfigure the host itself. The OS packages to install. The conf files to tweak. The processes to restart. This was not obvious, as the magical CLI incantations required to complete the task varied depending on which Linux distro and HTTP server I was running on a given box.

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 7
  • Go to Next Page »

twitter mastodon linkedin instagram linkedin

Have a great day. You're doing an outstanding job. 👍

About · Privacy

Copyright © 2007–2023 Ethan Banks