Tuesday, November 11, 2014

RSYNC using filter to include some files

use rsync with Filter option to include some files.

For example:


rsync -auvz -f'+ [Aa][Mm]*'  -f'+ */' -f'- *' /SOURCE-Folder/ /TARGET-Folder/



It means: exclude all files and include only files beginning with A and M (insensitive).

Wednesday, November 5, 2014

Add line to the beginning of a file in Bash

To add a line to the beginning of a file, use this command: 
 
sed -i '1s/^/YOUR NEW LINE\n/' YOUR-FILE.TXT

Thursday, October 30, 2014

Mysql 5.5 Innodb slow insert query issue

An upgrade MySQL from version 5.1 to 5.5 has very slowed Typo3 instances.

The reason was very slow insert queries in InnoDB tables.

In order to save you some distress, for a possible solution, add following line to my.cnf and restart the mysql:

innodb_flush_log_at_trx_commit=0



Wednesday, October 15, 2014

Disable SSLv2 and SSLv3 in Apache

The best way to disable both SSLv2 and SSLv3 and only enable TLS 1.0-1.2 is to use this configuration in your Apache configuration file:






SSLProtocol TLSv1
 
Example:
 
SSLEngine On
SSLProtocol TLSv1
SSLCertificateFile      domain.crt
SSLCertificateKeyFile   domain.key

Testing your SSL Version

if you want to test your ssl version details of perticular host use the following command:

openssl s_client -connect YOURDOMAIN:443

You need to replace YOURDOMAIN to your website hostname Output looks like below:

Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : ....
    Session-ID: ....

Wednesday, September 24, 2014

Checking Varnish configuration syntax

If you have updated your Varnish configuration and want to check it,
run this command:

varnishd -C -f /etc/varnish/default.vcl

if everything is correct, Varnish will dump out the genrated configuration, otherwise you will get an error message pointing you to a specific line number.

Tuesday, September 23, 2014

Benchmarking LAN Network Connectivity in Linux

Using netcat:

on destination machine run this command:
(This tells netcat to open port 20000 and listen for connections.)

nc -l 20000 > /dev/null


on source machine execute this command:
(This command will transfer 30MB of data over the network (a blocksize of 1MB, and 30 blocks, is 30MB)


dd if=/dev/zero bs=1M count=30 | nc HERE.COMES.DEST.IP 20000



Once all data is transferred, you’ll get the output from the dd command, showing throughput:


30+0 records in
30+0 records out
31457280 bytes (31 MB) copied, 5.40742 s, 5.8 MB/s





source: http://techthrob.com/2014/01/benchmarking-lan-network-connectivity-in-linux/




Friday, September 19, 2014

TYPO3 extension manger won't work in XAMPP under Windows

Add these lines to all three apache configuration files (http.conf, http-ssl.conf,http-xampp.conf):


<IfModule mpm_winnt_module>
 ThreadStackSize 8388608
</IfModule>


then restart the apache.

Thursday, September 18, 2014

Getting HTTP HEAD from command line

Install libwww-perl (Debian) / perl-libwww-perl (CentOS):

Debian: apt-get install  libwww-perl

CentOS: yum install perl-libwww-perl

Run this command:

GET -Used http://YOUR-WEBSITE.COM/

Monday, September 15, 2014

MySQL Database Benchmark

Installing sysbench:

apt-get install sysbench


Preparing the Test Database:

sysbench --test=oltp --oltp-table-size=1000000 --db-driver=mysql --mysql-db=test --mysql-user=ADMIN-USER --mysql-password=ADMIN-PASSWORD prepare

Running Test:
sysbench --test=oltp --oltp-table-size=1000000 --db-driver=mysql --mysql-db=test --mysql-user=ADMIN-USER --mysql-password=ADMIN-PASSWORD prepare

Cleaning test Databse:
sysbench --test=oltp --mysql-db=test --mysql-user=ADMIN-USER --mysql-password= ADMIN-PASSWORDcleanup

Thursday, May 8, 2014

Add locale to Ubuntu

check which locales are supported:
less /usr/share/i18n/SUPPORTED

Add locale (for example German) to list of generated: 
echo de_DE.UTF8 >> /var/lib/locales/supported.d/local

Regenerate list (it will invoke locale-gen...):
sudo dpkg-reconfigure locales

Friday, January 3, 2014

How to download entire Youtube channel using commands in ubuntu

Use youtube-dl command to download videos straight off of YouTube.


Install it:


apt-get install youtube-dl



To download an entire channel

youtube-dl -citw ytuser:USER


To download all videos on a playlist:

youtube-dl -citw PLAYLIST-URL