Format bytes with PHP – B, KB, MB, GB, TB, PB, EB, ZB, YB converter

Simple PHP function that formats the bytes to the desired form. Possible unit options are: Byte (B) Kilobyte (KB) Megabyte (MB) Gigabyte (GB) Terabyte (TB) Petabyte (PB) Exabyte (EB) Zettabyte (ZB) Yottabyte (YB) PHP byteFormat function for formatting bytes Function takes three parameter: (bytes mandatory, unit optional, decimals optional) <?php function byteFormat($bytes, $unit = "", $decimals = 2) { $units = array('B' => 0, 'KB' => 1, 'MB' => 2, 'GB' => 3, 'TB' => 4, 'PB' => 5, 'EB' => 6, 'ZB' => 7, 'YB' => 8); $value = 0; if ($bytes > 0) { // Generate automatic prefix by bytes // If wrong prefix given if (!array_key_exists($unit, $units)) { $pow = floor(log($bytes)/log(1024)); $unit = array_search($pow, $units); } // Calculate byte value by prefix $value = ($bytes/pow(1024,floor($units[$unit]))); } // If decimals is not numeric or decimals is less than 0 // then set default value if (!is_numeric($decimals) || $decimals < 0) { $decimals = 2; } // Format output return sprintf('%.' . $decimals . 'f '.$unit, $value); } Example usage echo byteFormat(4096, "B"); echo byteFormat(8, "B", 2); echo byteFormat(1, "KB", 5); echo byteFormat(1073741824, "B", 0); echo byteFormat(1073741824, "KB", 0); echo byteFormat(1073741824, "MB"); echo byteFormat(1073741824); echo byteFormat(1073741824, "TB", 10); echo byteFormat(1099511627776, "PB", 6); Output
Read more →

Delete files permanently with shred command in Linux – Remove absolutely

Sometimes we need to delete files which content should disappear absolutely, completely and safely. Linux command rm just remove file and it’s still possible to dig out from the disk. Fortunately for Linux can be found in shred program that removes the files permanently. Shred command is easy and quickly to use cases when files need to deleted forever. Shred command usage Create test file: echo "testing testing" > /tmp/test.txt Delete file with shred command: shred -v -n 25 -u -z /tmp/test.txt Output:
Read more →

Twitter Hacked by Iranian Cyber Army

Twitter site is hacked by Iranian Cyber Army. Here is some screenshots and full info about page. Screenshots Server info and full html content lynx -mime_header http://twitter.com HTTP/1.1 200 OK Date: Fri, 18 Dec 2009 06:42:08 GMT Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8l DAV/2 mod_auth_passthrough/2.1 FrontPage/5.0.2.2635 Last-Modified: Fri, 18 Dec 2009 06:21:13 GMT ETag: "90c06a-717-47afabf13c840" Accept-Ranges: bytes Content-Length: 1815 Connection: close Content-Type: text/html <meta content="en-us" http-equiv="Content-Language"></meta> <meta content="text/html; charset=windows-1252" http-equiv="Content-Type"></meta> <title>..:: This Web Site Has Been Hacked By Iranian Cyber Army ::.. </title> <p align="center"> </p> <p align="center"><img border="0" src="index.6.gif"></img><img border="0" src="index.2.gif"></img><img border="0" src="index.7.gif"></img></p> <p align="center"><img border="0" src="index.8.gif"></img></p> <p align="center"> <a href="mailto:[email protected]?subject=Mowjcamp"> <img border="0" src="index.5.gif"></img></a></p> <p align="center"><img border="0" height="106%" loading="lazy" src="index.3.jpg" width="43%"></img></p> <p align="center"><font face="Tahoma" size="2"><b> </b></font></p> <p align="center"><b><font color="#FFFFFF" face="Tahoma" size="2"> بنام خدا<br></br> به عنوان یک ایرانی در پاسخ به دخالت های شیطنت آمیز این سرویس دهنده به دستور مقامات آمریکایی در امور داخلی کشورم ) <br></br> این سایت به عنوان هشدار هک می شود <br></br> </font></b></p>
Read more →

Twitter hacked? Not really, only Twitter DNS records compromised

I before post ‘Twitter Hacked by Iranian Cyber Army’, but actually just Twitter DNS records was hacked. I think even twitter.com server headers and tracepath to servers simply prove this, because they are completely different normally when hacked. Hacked twitter.com headers: HTTP/1.1 200 OK Date: Fri, 18 Dec 2009 06:42:08 GMT Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8l DAV/2 mod_auth_passthrough/2.1 FrontPage/5.0.2.2635 Last-Modified: Fri, 18 Dec 2009 06:21:13 GMT ETag: "90c06a-717-47afabf13c840" Accept-Ranges: bytes Content-Length: 1815 Connection: close Content-Type: text/html Original twitter.com headers: HTTP/1.1 200 OK Date: Fri, 18 Dec 2009 08:25:54 GMT Server: hi X-Transaction: 1261124754-68110-699 Status: 200 OK ETag: "592480ad9f6feea20711b47bc5e64dbb" Last-Modified: Fri, 18 Dec 2009 08:25:54 GMT X-Runtime: 0.02009 Content-Type: text/html; charset=utf-8 Pragma: no-cache Content-Length: 20957 Cache-Control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0 Expires: Tue, 31 Mar 1981 05:00:00 GMT X-Revision: DEV Set-Cookie: auth_token=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: param_q=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: param_page=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: param_status=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: param_in_reply_to_status_id=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: param_in_reply_to=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: param_source=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: param_user=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: param_id=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: dispatch_action=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT Set-Cookie: _twitter_sess=BAh7CToRdHJhbnNfcHJvbXB0MDoMY3NyZl9pZCIlNzVhYTY3YTZlNjMxNTky%250AMjk5NzkzNGZiMTIxNDg0ZWQ6B2lkIiVkOGE0MzJkYTFjZWQzNGUzMWM1ZThk%250AMThlMTUwN2VlOCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6%250AOkZsYXNoSGFzaHsABjoKQHVzZWR7AA%253D%253D--379506ebd11ed1403680db265ae97bf4c3768b7b; domain=.twitter.com; path=/ Vary: Accept-Encoding Connection: close Hacked twitter.com tracepath tracepath http://www.twitter.com ... 7: lax009-phx007-832-cr1.phx007.internap.net (66.79.147.182) 40.415ms asymm 8 8: cr2-cr1.phx007.internap.net (66.79.147.174) 46.740ms asymm 9 9: dal005-phx007-833-cr1.dal005.internap.net (66.79.147.177) 54.298ms asymm 7 10: dal005-tor003-1160-cr1.tor003.pnap.internap.net (66.79.147.230) 86.102ms asymm 7 11: tor001-tor003-769-core1.tor001.internap.net (66.79.153.34) 98.458ms asymm 9 12: border1.te9-1-bbnet2.tor001.pnap.net (70.42.24.196) 94.665ms asymm 9 13: netfirms-1.border1.tor001.pnap.net (70.42.26.54) 104.351ms asymm 10 Working twitter.com tracepath tracepath twitter.com ... 7: ae-2.r22.londen03.uk.bb.gin.ntt.net (129.250.2.77) 33.762ms asymm 12 8: as-0.r20.nycmny01.us.bb.gin.ntt.net (129.250.3.254) 105.484ms asymm 12 9: ae-0.r21.nycmny01.us.bb.gin.ntt.net (129.250.2.26) 105.688ms asymm 12 10: as-0.r20.chcgil09.us.bb.gin.ntt.net (129.250.6.13) 124.634ms asymm 12 11: ae-0.r21.chcgil09.us.bb.gin.ntt.net (129.250.3.98) 122.439ms asymm 12 12: as-5.r20.snjsca04.us.bb.gin.ntt.net (129.250.3.77) 185.225ms 13: xe-1-1-0.r20.mlpsca01.us.bb.gin.ntt.net (129.250.5.61) 186.349ms asymm 14 14: mg-1.c20.mlpsca01.us.da.verio.net (129.250.28.81) 189.346ms 15: 128.241.122.101 (128.241.122.101) 189.184ms 16: 128.241.122.101 (128.241.122.101) 189.468ms !H
Read more →

Best Google Chrome Search Engine Optimization (SEO) Extensions

Here is a list of the best Google Chrome Search Engine Optimization (SEO) extensions (plugins). Search Engine Optimization (SEO) Extensions Chrome SEO The Google Chrome SEO Extension. Make your SEO tasks easier with Chrome SEO Tools, includes ‘all’ the stats and data you need. Install Extension SEO Status Pagerank/Alexa Toolbar SEO Status is lightweight. It will check the Google Pagerank (PR) & Alexa rank for every page. Using this will increase your Alexa. Install Extension | Developer website
Read more →

if-not-true-then-false.com New Look

This new design (using Arras Theme) has just been published and will still develop, so any comments and opinions are very welcome. In my opinion, the new layout is much lighter and clearer. Also blog’s content is intended to bring out clearer for blog readers and users. Please leave comment and tell your opinion! Old layout screenshot: New layout screenshot:
Read more →

Find If Not True Then False on Facebook

I would like to welcome all new and old visitors to If Not True False Then site Facebook pages. Hopefully, this new Facebook page also helps to follow new blog posts. Of course, there is also other ways to follow this blog posts, simply using RSS Feed and Twitter. So following step is check out If Not True Then False Facebook page and like it. :) Like If Not True Then False on Facebook:
Read more →

CentOS Stream Netinstall Guide – CentOS 8 Stream Installation Screenshots

This is CentOS 8 Stream installation guide, step-by-step walkthrough with screenshots. The CentOS 8 is available for the following architectures Intel/AMD 64-bit IBM Power little endian ARM 64-bit Check video version of guide: Support inttf: Buy Me a Coffee: Buy me a coffee Subscribe and follow: Follow @inttf On this guide I use Anaconda Graphical Installer and CentOS 8 Stream DVD ISO. You can alternatively use Stream Boot ISO or 8.0.1905 medias.
Read more →

Support inttf:

Buy Me a Coffee:

Support inttf:

Buy me a coffee Buy me a coffee