Using the preg_replace function you can easily replace all characters in a string that are not alphanumeric. This can be useful for sanitizing a string
Fix SSH Key Permissions (Permissions are too open private key will be ignored)
Sometimes you’ll get an error on your ssh client when you’re working with a new ssh key and you’re trying to ssh into the server.
Listing Files Only With Grep Command
To only show the file names and not a preview of data add the command line param -l to grep. The below example searches in
Using Ghostscript CLI to Shrink a PDF
Shrinking a PDF with Ghostscript is easy in Linux. Below are 3 ghostscript commands to shrink PDFs to a few different levels. screen – lowest
Auto Selecting Input Field Contents on Mouse Entering Field
You can do this simply with an onclick event like below.
Add an Image to the DOM Dynamically
This example will work fairly well cross-browser. In IE it will use new Image and everything else it will use createElement. There are bugs in
Select Last N Characters of a Field
Using the substring function, this example below will select the leftmost 6 characters from a string field named “field_name” in the table tbl_stuff with mysql.
How to Remove Duplicate Lines From a Text File In Linux
You can combine the sort and uniq command line programs to remove duplicate lines from a text file. In the example below, it will produce
How to Jump to a Line Number in VI Editor
To go to a specific line number in VI, first, make sure you’re not in editing mode by hitting ESC. Next type the line number
Seeing Full Warnings That Just Happened After a Query
After you run a query on MySQL server you may get warning messages. To see the complete warnings you simply run the command show warnings.