Category Archives: Sh*ts

My new server bandwidth graphs

 

Graph daily bandwidth – That boost was after pointing a single subdomain to the new server.
Graph weekly bandwidth – On Wednesday I’v switched some domains and subdomains to the server.
Graph monthly bandwidth – first weeks were just to move content from the old server.

Edit hosts on a Mac OS X

Hosts files are located at /private/etc/.

Edit and add our new host configuration/ip.

sudo nano /private/etc/hosts

or

sudo nano /etc/hosts

Flush DNS cache

sudo dscacheutil -flushcache

This way we can have www.domain.com on a server for regular users and set up our own www.domain.com pointing to another server while we set up, for example, the migration.

Sony announced it had crammed 185TB of data

Sony has brought the cassette back from the dead by unveiling a tape that can hold a whopping 148 gigabytes per square inch. If you can’t do the math, that’s 185 terabytes of total data.

(…)

So, just how much data can a tape with 185 TB capacity actually hold? Here’s a few handy comparisons (via ExtremeTech):

– It’s three Blu-rays’ worth of data per square inch. Or, a total of 3,700 Blu-rays on a single tape. That’s a stack of boxes that would be nearly 15 feet high.

– A single tape holds five more TB than this hard drive storage array, which has to be custom-made and runs for $9,305.

– A total of 64,750,000 songs. If the average song is, say, three minutes, that’s enough music to last you 134,896 days.

– The entirety of the Library of Congress represents about 10 total TB. One tape can hold 18.5 versions of the Library of Congress.

The tape will be available for commercial sale, but no word yet on a release date. However, as Gizmodo points out, the super tape was originally developed for “long-term, industrial-sized data backup” and not necessarily for music, game, and video storage and playback.

http://consequenceofsound.net/2014/05/r-i-p-ipod-sony-unveils-cassette-tape-that-can-hold-64750000-songs/

Seedtest – New dedicated server

 

Testing download speed........................................
Download: 499.98 Mbits/s
Testing upload speed..................................................
Upload: 196.86 Mbits/s

Testing download speed........................................
Download: 475.47 Mbits/s
Testing upload speed..................................................
Upload: 213.55 Mbits/s

Testing download speed........................................
Download: 466.27 Mbits/s
Testing upload speed..................................................
Upload: 215.19 Mbits/s

 

Using http://www.digitalwhores.net/linux/how-to-test-server-speed-in-your-consoleterminal/

Force download MP4 file – PHP or .htaccess

The PHP way – see below this one for a better way

In a client work, I need to force download a MP4 file on some special occasions.
PHP was the solution – in my case -.

rock ssd

This is the small script that I’v placed in download.php – the important stuff -.
Before I have a file_exist condition and other stuffs… but this is the RAW material!

 header ("Content-type: octet/stream");
 header ("Content-disposition: attachment; filename=".$filename.".mp4;");
 header("Content-Length: ".filesize($myFile));
 ob_clean();
 readfile($myFile);

Some of the MP4 files were beeing downloaded! Other weren’t. sh*t!
The problem was a PHP Fatal error!

[03-May-2014 08:09:18] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 429363201 bytes) in /web/sites/user/domain.com/download.php on line 30

Well!, there are 3 ways to solve this.

  • Edit php.ini and increase the max memory size.
  • Add the following line to the PHP file…
ini_set('memory_limit','128M');
  • Or add the following line to .htaccess
php_value memory_limit 128M

First solution is the best option, since the other 2 might not work due to security settings.

The PHP way *ultimate solution*

This solution we don’t need to increase PHP memory limit.
This will read 8kb of file and push it to the client AND not the full file!

header ("Content-type: octet/stream");
header ("Content-disposition: attachment; filename=".$filename.".mp4;");
header("Content-Length: ".filesize($myFile));
ob_clean();
$handle=fopen($_REQUEST['file'], 'rb');
while (!feof($handle))
{ 
    echo fread($handle, 8192);
    flush();
}
fclose($handle);

The .htaccess way

The normal file type for MP4 is video/mp4.
This way the browser will try to play it and won’t download it.

We can force .htaccess to change it and force the download.

Lets say that we want to force the download when the URL has a ?dl.

RewriteCond %{QUERY_STRING} dl
RewriteRule .*\.mp4 - [T=application/octet-stream]

This way .htaccess www.domain.com/video.mp4?dl and change the file type to application/octet-stream – the one that forces the download.