TIL: How to use list comprehensions in python
In the past, if I wanted to make a new list by pulling values out of an existing list based on a condition I would have done something like:
def listItems(): a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] new = [] for num in a: if num % 2 != 0: new.append(num) print new But, I figured out via https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions that list comprehenisions can dramatically compress these functions while still maintaining readability.
Design your systems as if they’re already on fire
You’re walking everyone through the postmortem for last night’s outage. You’ve described the issue, you’ve detailed the root cause and remediation, and the team is about to talk through lessons learned and action items.
Someone (probably your manager) asks, “How can we make sure this never happens again?”
Pause here before you respond. There are, at a minimum, two ways to interpret this question:
The literal interpretation – How can we prevent this specific failure from reoccurring?
TIL: How to disable core dumps on AWS Linux
I ran across a situation where a previous sysadmin had enabled core dumps on a server that were filling up the root volume. The dumps weren’t needed, so I decided to disable them, problem is, I’ve never really dealt with core dumps because I’ve never had to, so I had to do some Googling.
Here’s the result:
disableCoreDumps.sh #!/bin/bash # Only tested with AWS Linux but should work on RHEL, CentOS, Fedora, etc.
How to get started with DevOps
The question that comes up the most when I talk to people who are interested in DevOps is “Where do I start?”
Most of the time, the answer they’re looking for is a list of tools and technologies to learn, so they usually look disappointed when they hear my answer.
If you want to get started in DevOps, if you want to deliver faster and keep up with everything that’s being asked of you without killing yourself in the process, tools and technology are the wrong places to start.
TIL: How to get RedShift to access S3 buckets in a different region
While trying to get a Spark EMR job running, I encountered this error on a Spark step that copied data from RedShift to S3.
I’ve seen issues in the past with S3 buckets outside of US-East-1 needing to be targeted with region-specific URLs for REST (https://bucketname.s3.amazon.com vs. https://bucketname.us-west-2.s3.amazon.com) but had not seen anything similar for s3:// targeted buckets.
This got me looking at Hadoop file system references, none of which are helpful because EMR rolls their own, proprietary file system for Hadoop S3 access.
TIL: How to get JBoss AS to gracefully handle database server failovers
Today I learned how to get JBoss AS (Wildfly) to not lose its mind during a database server failover event (as occurs in the cloud quite often).
The config is simple, but finding comprehensive documentation is a bit challenging since most current JBoss docs require a RedHat subscription. So you’re stuck piecing things together from multiple sites that contain tidbits of what’s needed.
Note: This is for a DBaaS scenario (think AWS RDS or Azure SQL Database), where the DB load balancing is done downstream of your app server.
Designing Ansible for flexibility and simplicity
When I was first getting started with Ansible, I struggled a lot with the layout for my projects. The Ansible best practices docs were a little bit of help (they’ve gotten way better), but like most “best practices” they solve for a very simple use case.
Google generally wasn’t much help either. Most of what I found solved for “I am running a two tier application on a couple of machines”.
Dirty secrets of DevOps
I’ve read dozens of DevOps success stories, tales of bold IT leaders transforming their business and steering big corporate ships into the future. It’s hard to avoid all these stories about “DevOps transformation” and how some guy named Jim pulled the IT department out of the stone age. The trades, blogs, and conference presentations are filled with them.
No one talks about the failures though, very few even write about their struggles implementing DevOps.
Admit your struggles, help others
My worst grades in K-12 and university were all for math classes. Algebra, trig, calc… they all made me feel stupid to a point of hopelessness. I got the basics, but as soon as things started getting abstract, I lost my grip.
I tried and tried and tried, but none of it clicked into place.
I’ve never been one to give up easily on solving problems, but I gave up on math and that steered me away from scientific fields and programming, even though I had interests in both.