How to downgrade macOS? Instructions with installer links

How to find and install older macOS/OS X versions? If you want to download installer images and downgrade your operating system here you can find some instructions.

Continue reading How to downgrade macOS? Instructions with installer links

When copying a large file on Linux transfer hangs at the end… And you want to f**king kill someone.

There’s an annoying bug in almost every Linux distribution I’ve worked with. When your copying a large file to usb device (pendrive etc.) it hangs at the end (I mean it haaaaaaaaaaaaangs).

I’ve found a solution that works on Elementary and Ubuntu (at least).

Simply paste this two commands in your terminal:

sudo sh -c 'echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes'
sudo sh -c 'echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes'

Add this to some kind of startup script and forget about transfer problems…

How to watch file count in a directory (Linux/macOS)?

If you want to monitor file count in some directory simply use this:

watch "ls -A | wc -l"

You can also mask specific files using asterisk char:

watch "ls sess* -A | wc -l"

If you get Argument list too long error, please change command syntax to this:

watch "ls -U | grep -c '^sess'"

How to mirror (statically) a website?

If you want to copy a website really really fast use HTTrack with following switches:

httrack -K --sockets=50 --disable-security-limits --max-rate=0

It works on Linux (there’s a native Debian package) and Windows.

Check documentation for other options. K is very important because it affects link generation. If you want original links without html extensions use it like above.

K option cheatsheet:

βˆ’K0foo.cgi?q=45 βˆ’> foo4B54.html?q=45 (relative URI, default)
βˆ’Kβˆ’> (absolute URL) (βˆ’βˆ’keepβˆ’links[=N])
βˆ’K3βˆ’> /folder/foo.cgi?q=45 (absolute URI)
βˆ’K4βˆ’> foo.cgi?q=45 (original URL)
βˆ’K5βˆ’> (transparent proxy URL)

And last but not least…

If you want to rewrite original links to html static links use this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.html
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.html
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

How to do something between exact two dates in PHP?

Sometimes you need to show something on your website in timeframe. This snippet will show you how to do it precisely: