Author: matt
-
Git changelog for particular line numbers
I often need to go spelunking through code that predates my work on the codebase. Sometime looking through the commit history for a large file can be rather overwhelming if there are lots of commits not related to the particular section of the file you are interested in. I recently discovered that git log has…
-
Open File With App From MacOS Terminal
Sometimes I like to open up a text file in a robust gui text editor on my mac while I am working in the terminal. Navigating to the same location in finder and then opening the file is just a pain. So after a little googling I discovered the open command. Here’s an example of when…
-
Owning Content
So I’m reviving my personal site. In the past I was worried about owning the storage of my content so I self hosted this site on wordpress, which is honestly a pain for just wanting to write some stuff every so often. So what was my solution? I migrated the little bit of content I…
-
Replace a string inside of a MYSQL field
I recently needed to replace part of a URL found inside the body HTML of a page that was stored in a MySQL column. In order to do this I was able to use the handy Replace() MySQL function. UPDATE myPage SET pageBody = REPLACE(pageBody, ‘/oldirectory’, ‘/newdirectory’) WHERE INSTR(pageBody, ‘/olddirectory’) > 0; The INSTR() function is not technically…
-
Splitting Large Log Files
Every so often you run into a log file that doesn’t have a log rotation set up and has grown so large that it is near impossible to open in many editors. Today I ran into one of those files that was 1.5GB. Thankfully there is a handy split utility that can generate chunked text…
