There are a number of ways to make variables readable, and also to distinguish what variable types you might be working with. These things change from language to language, but it’s nice to have a common set of vocabulary to refer to them. I find that I’m sometimes forgetful of how to actually refer to any given case, so here’s a quick reference. Case Example Snake Cases snake_case Camel Case camelCase Pascal Case Pascal Case Kebab Case kebab-case I’ve found that I often want to be able to switch from one to another, and that there’s always a solution already in existence, the most helpful thing is knowing what to call it for the sake of googling.
www and apex domains pointing to github pages
Saving time and money with GitHub Pages I know that GitHub Pages are nothing new, but I only recently realized how versatile they are. You can host any static content you want there for free, and I’ve recently started using it for my blogs. Major benefits of using GitHub Pages as I see it: Free hosting for simple pages Deployment is as easy as a git push SSL certs are a one time checkbox It handles redirecting to the www subdomain, or to the apex domain without no real configuration My default configuration You just have to set up the DNS.
So, you have a webpage on your computer you want to show to a remote person?
Note: If you don’t have a server already, check my last tip. This topic is always a little tricky, so, here’s the basic thing to know, as this is the most frequent use case. Suppose you have a development rails server running on your local computer. You can access this server via curl http://localhost:3000. Which is to say, it’s running on your localhost, on port 3000. You want your client to see it, to give you feedback, but they’re nowhere near you, and you just want a quick way to show it to them.
How to get DNS info out of MediaTemple
I was in the process of moving my DNS from MediaTemple to Route53 and was having trouble making sure I’d moved all of the entries. I decided I’d just export a zone file to do a comparison in a text editor. Surprise! You can’t. Instead, here’s a quick bit of jQuery, which is already available in the MediaTemple control panel. Just navigate to the zone file editor, open your console, and use this:
Why the heck is my alpine docker image so huge? That’s a tough question to answer, especially when you have no idea what’s taking up all of the space. This is a dirty little one-liner that yields a sorted list of all of the packages on your alpine image by size. It does this by Getting the complete list from apk info Iterating over the results to ask apk for its size Removing the blank lines Combining the size lines and the name lines Sorting by size apk info | while read a; do apk info -s $a; done | awk NF | sed 'Ns/\n/ /' | sort -k4 -n It may be ugly, but now I can make an informed decision about wether or not there are binaries that can be axed.
Address already in use Damn. Did I leave a server running somewhere? Sometimes you’re not sure where you left a server running, or where something is running you never knew about. I’m finally writing this down, as I always have to look it up. I found this solution in a StackOverflow post. Here’s how to get all of the processes by what port they’re using. sudo lsof -iTCP -sTCP:LISTEN -n -P As A Shell Function Looking at it, I realized I would never remember it, given how infrequently I need it.