How To Find All git Commits Containing a Specific Log Message

Author: , Posted on Thursday, July 9th, 2020 at 4:27:41pm

Show commits and messages that match

Include code diffs

Include file names

How To Modify Files Inline Using PERL Edit In Place

Author: , Posted on Wednesday, July 8th, 2020 at 3:57:44pm

How To Get a Formatted Date in Perl

Author: , Posted on Wednesday, July 8th, 2020 at 3:10:07pm

How To Pretty Print JSON in PHP

Author: , Posted on Thursday, June 11th, 2020 at 12:07:49pm

If you ever want to view your JSON as a human ;-}

$pretty_json = json_encode($data, JSON_PRETTY_PRINT);

https://www.php.net/manual/en/function.json-encode.php

How To Merge Object Variables in PHP

Author: , Posted on Thursday, June 11th, 2020 at 8:10:11am

$merged_object = (object) array_merge((array) $object1, (array) $object2);

How To Vertically Align Blocks Using CSS

Author: , Posted on Thursday, June 4th, 2020 at 11:18:32am

Outer Block – set the line-height: {some value}
Inner Block – set the line-height: normal, along with display: inline-block; vertical-align: middle;

Also works if you set OUTER height instead of the line-height (or together with the same value as the height).

How To Prevent Automatic HTML Line Breaks

Author: , Posted on Thursday, May 14th, 2020 at 11:14:20am

Recently, I had a list of command-line options in a table, and my browser was automatically inserting a line-break in-between the hyphen and the option character.

To prevent this, I simply added a little CSS:

NOTE: Never use the

HTML directive – it is obsolete!

How To Change the Destination Admin Email Address for User-Meta Pro Notifications

Author: , Posted on Monday, May 11th, 2020 at 1:28:22pm

Snow in May!

Author: , Posted on Saturday, May 9th, 2020 at 10:59:02am

How To Empty the Cache in Prometheus Using Curl

Author: , Posted on Thursday, May 7th, 2020 at 3:17:16pm

I wanted to empty the time series data cache from the Prometheus server to start clean.

The best practice is to use the administrative HTTP API via curl. For example, to clear all data for job mysqld as defined in the prometheus.yml configuration file:

If you want to delete ALL data from Prometheus, then execute:

Since Prometheus keeps deleted data for 15 days by default, you may want to speed up that process by executing:

You can change the default of 15 days by setting the --storage.tsdb.retention option.


NOTE: The administrative HTTP API is disabled by default!

To enable it, add the --web.enable-admin-api argument to the prometheus commend at startup.

For example, this is an excerpt from my /etc/init.d/prometheus service script:

Credits:
Thanks to ShellHacks – https://www.shellhacks.com/prometheus-delete-time-series-metrics/