peter's blog
Bash History Lesson #1 - Timestamp
The Problem
The command line is the developer's number 1 friend and ally, but usually out-of-the-box configuration is very bare and uninformative. Every seasoned developer out there will have their own way of customizing the shell prompt, shell commands and even which shell better fits their needs. While this post will focus on the bash history command, bash being the default shell on the vast majority of systems out there, the same concepts can be used to customize other shells as well.
To be clear: we are going to spice up the results of the history command on the bash shell.
Sensible Auto Git Tagging Deployments to Production on Jenkins
The Problem
You've built your code, and you have a spiffy Jenkins setup to pull from git and run your tests for you, and you want to keep track of the pushes you do to your production environment. By default, Jenkins produces a local tag on the job's workspace named something like this: jenkins-<job-name>-<sequence-number>. However that doesn't tell you much. And that is not pushed to the remote repo.
As a developer, I'd prefer to just look at the list of tags on a repo and know which ones refer to pushes to production, and also know some more information about them without having to check them out and without having to inspect their logs. As you must know, according to Uber-Geek Larry Wall, developers are lazy! And impatient! And full of hubris! And that is a very good thing!
Make word-back and word-forwards navigation work again on PhpStorm's Terminal
The Problem
JetBrains' IDEs are awesome! The more you get into them, the more you rely on them. One problem, however, has pestered me for a while: the built-in terminal doesn't have support for the word-back and work-forwards shortcut. You know, when you hold alt + left-arrow or alt + right-arrow? Most of the time I use a Mac, so in the past I used a pretty nifty program called "Keyboard Maestro" to create a shortcut that worked only on PhpStorm and other JetBrains IDEs that would do that for me, but as well as that worked, I always wondered if there was a nicer way. Turns out there is!
Create Diagrams Inside PhpStorm with PlantUML
Diagramming in PhpStorm (or any other JetBrains IDE)
A picture is worth a thousand words, and a well-constructed diagram is worth many pictures! And if it is super-simple to create these useful diagrams, why not, right? This quick post will guide you (and future me) on the steps necessary to get PlantUML - a diagramming library - setup in JetBrains PhpStorm.
Let's dance with DSH!
The Problem
You are a developer troubleshooting performance issues on production and you want to look at server logs. The web servers are in a load-balancing cluster that you have no access to, and the incredible folks responsible for the devops of this setup do not have the very basics of centralized logging configured... Not that I've found myself in this situation... Uh, I'm asking for a friend of a friend... ;)
There and Back Again...
Fix MAMP Error: "General error: 2006 MySQL server has gone away"
While working on a local copy of a Drupal site I am helping develop, I ended up hitting the following error:
General error: 2006 MySQL server has gone away: SELECT ff.* FROM {filter_format} ff ...
Ugh! Now what?! We need to change a setting on MySQL that ships with MAMP. As it turns out, the default max_allowed_packet is set to 1M and it needs to be higher. Changing that to 100M did the trick for me. Locate your my.cnf file and add the following setting under the [mysqld] section:
quick fix for CentOS locale issue on new virtual environment
We've just setup a new virtual environment, and upon login found this nice error:
# ✔ peter@endor(ttys002) ~ ssh new-server Last login: Wed Jul 17 08:27:23 2013 from 192.168.73.37 -bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory -bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory -bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_US.UTF-8): No such file or directory -bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_US.UTF-8): No such file or directory -bash: warning: setlocale: LC_TIME: cannot change locale (en_US.UTF-8): No such file or directory
And...
easy way to change the current branch (HEAD) on a remote git repo...
Just had an interesting problem today where I needed to blast away the remote copy of a git master branch (don't ask!), but I couldn't do that because it was the current branch.
I quick question to a local git guru and the answer was very easy:
git remote set-head <remote> <branch>
Then I was able to delete the rotten origin/master branch, create it again from a good branch, reset it to HEAD and life was good again!
Easy Peasy!
-PCP
fix (workaround) the thousands of log entries that logitech solar service creates on osx
It turns out that you can "instruct" syslogd so that it ignores all messages from Solar Service instead of writing them to /var/log/asl. Here's how:
1. Add the following two lines in /private/etc/asl.conf:
# Ignore messages from Logitech's Solar Service.app
? [CS= Sender Solar] ignore
2. Reboot
OR simply restart syslogd by running:
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist
Sources where I found all this information: