Copyright © if not true then false. All Rights Reserved. Snowblind by Themes by bavotasan.com. Powered by WordPress.

This is a very typical case, the need to create a temp file on the command line quickly. Opening editor, writing content, save file and quit editor is not the fastest possible way. A faster way is to use the cat command with the name of the file and write contents of the file and give the end-of-file character (Ctrl-D).
Create Temporary File Without Editor on Command Line
# Create file $ cat > /tmp/temp_file_name.txt some content more content and even more content <Ctrl-D> # View file content $ cat /tmp/temp_file_name.txt some content more content and even more content
Append to Temporary File Without Editor on Command Line
# Append to file $ cat >> /tmp/temp_file_name.txt append content append more content append even more content <Ctrl-D> # View file content $ cat /tmp/temp_file_name.txt some content more content and even more content append content append more content append even more content
Very easy, quick and usefull!
Memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load. Memcached is a very useful also in other cases, than only dynamic web applications.
This guide explains howto install Memcached 1.4.4 current stable version of distributed memory object caching system on CentOS 5.4, Fedora 12 and Red Hat RHEL 5.4. Fedora 12 has Memcached 1.4.4 as default so extra repositories is not needed on Fedora 12.
Install Memcached 1.4.4 Distributed Memory Object Caching System
» Continue Reading "Howto Install Memcached 1.4.4 Caching System on CentOS, Fedora, Red Hat"
I was using simple function to calculate difference between two dates and timestamps until I noticed, it’s not working correctly in long intervals. It’s very easy to calculate difference between two timestamps in seconds, but it’s much more complicated print difference in human readable format. The Internet can be found in a wide range of ways to do this thing, but as a rule they use a fixed amount of seconds for the year and the month. So if we calculate year with using 365 or 365.25 days and month using 30 or 31 then the difference is not accurate, because of leap years, DST (Daylight Saving Time) and so on.
Because of this problem, I decided to make a function (at least in the short testing) to return the right kind of differences between the UNIX timestamps and dates in human readable format. This function uses PHP strtotime function to calculate real differences and can handle leap years and DST. This function can also return Twitter like about texts with precision parameter.
» Continue Reading "PHP: Calculate Real Differences Between Two Dates or Timestamps"
This is quick guide howto find files and directories quick and efficiently on Linux with locate command. Linux find command is outdated, slow and complicated to use, so locate command is much better option.
Locate basic usage find files and directories
locate file # example locate httpd.conf locate path # example locate /X11/
» Continue Reading "Linux locate command: Find Files and Directories Quickly and Efficiently"
This is a quick method with using cURL to check that Apache Compression with mod_gzip and mod_deflate is working. Only the remote server headers are needed.
Check that the Apache Compression is Working
Get headers
curl -I -H 'Accept-Encoding: gzip,deflate' http://www.if-not-true-then-false.com
-I option which will make just HEAD request to server and get headers.
-H option add header for accecpt content-encondig gzip and deflate.
Check headers
» Continue Reading "cURL Tip: Check that the Apache Compression (gzip, deflate) is Working"
