add js or css depending on browser with php with the below short code:


<?=    (preg_match('/Safari/i',$_SERVER["HTTP_USER_AGENT"] )) ? 'body{line-height:1.2; margin:0;padding:0;} @media print { html, body { margin: 0; padding: 0; }' : '' ?>

Also you can do more with the below code

$u_agent = $_SERVER['HTTP_USER_AGENT'];
$bname = 'Unknown';
$platform = 'Unknown';
$version= "";

//First get the platform?
if (preg_match('/linux/i', $u_agent)) {
$platform = 'linux';
}
elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
$platform = 'mac';
}
elseif (preg_match('/windows|win32/i', $u_agent)) {
$platform = 'windows';
}

if(preg_match('/Safari/i',$u_agent))
{
$bname = 'Apple Safari';
$ub = "Safari";
}
0

easy docker for high speed internet proxy


docker pull sameersbn/squid:3.3.8-15

docker build -t sameersbn/squid github.com/sameersbn/docker-squid
Start Squid using:
docker run --name squid -d --restart=always -v "/root/squid":/etc/squid3 \
--publish 3128:3128 \
--volume /srv/docker/squid/cache:/var/spool/squid3 \
sameersbn/squid:3.3.8-15
0

mount fuse drive with ssh command, very useful for s3

sudo sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa [email protected]:/ /mnt/droplet
0

Linux speed test and benchmarking commands are tools I use are these

For cpu:

sysbench --test=cpu --cpu-max-prime=20000 run

For network:

wget -O /dev/null http://speedtest.dal01.softlayer.com/downloads/test100.zip
wget -O /dev/null http://speedtest.sea01.softlayer.com/downloads/test100.zip
wget -O /dev/null http://speedtest.ams01.softlayer.com/downloads/test500.zip

For Disk write speed:

wget http://speedtest.ams01.softlayer.com/downloads/test500.zip
0

Docker commands for elasticsearch cluster,are here

————————START MAIN————————–
————————REFERENCE COMMANDS——————
docker run -d –name es0 -p 9200:9200 es
docker run -d –name es1 –link es0 -e UNICAST_HOSTS=es0 es
docker run -d –name es2 –link es0 -e UNICAST_HOSTS=es0 es
————————REFERENCE COMMANDS——————Continue reading

0