Edit the servers file
/etc/.subversion/servers
and set the proxy server and port.
Uncomment
and change the lines necessary:
[global]
# http-proxy-exceptions = *.exception.com, www.internal-site.org
http-proxy-host = yourproxy.server.com
http-proxy-port = 8080
# http-proxy-username = defaultusername
# http-proxy-password = defaultpassword
# http-compression = no
# http-auth-types = basic;digest;negotiate
# No http-timeout, so just use the builtin default.
# No neon-debug-mask, so neon debugging is disabled.
# ssl-authority-files = /path/to/CAcert.pem;/path/to/CAcert2.pem
If you get some error like this:
svn: /etc/.subversion/servers: 148: Option expected
then it means that you have a space at the start of the property
which you have un-commented. Make sure that there is no space in the
beginning of the property in the servers file.
Wednesday, October 24, 2012
Tuesday, September 11, 2012
Update mysql table records, which contain umlaut
Use your database and run this MySQL command for your desired Table:
UPDATE YOUR_TABLE SET YOUR_FIELD = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(YOUR_FIELD,'ä','ae'),'Ä','Ae'),'ö','oe'),'Ö','Oe'),'ü','ue'),'Ü','Ue');
UPDATE YOUR_TABLE SET YOUR_FIELD = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(YOUR_FIELD,'ä','ae'),'Ä','Ae'),'ö','oe'),'Ö','Oe'),'ü','ue'),'Ü','Ue');
Rename files- & directories-name which contains umlaut
I would like to change the file name, which contains umlaut, with normal characters:
For example: ü with ue or Ä with Ae.
Here is my commands:
for i in `find -name '*ü*'`; do mv $i `echo $i | sed 's/ü/ue/'`; done
or
for i in `find -name '*Ä*'`; do mv $i `echo $i | sed 's/Ä/Ae/'`; done
and the following command for the directories:
for i in `find -type d -name '*Ä*'`; do mv $i `echo $i | sed 's/Ä/Ae/'`; done
For example: ü with ue or Ä with Ae.
Here is my commands:
for i in `find -name '*ü*'`; do mv $i `echo $i | sed 's/ü/ue/'`; done
or
for i in `find -name '*Ä*'`; do mv $i `echo $i | sed 's/Ä/Ae/'`; done
and the following command for the directories:
for i in `find -type d -name '*Ä*'`; do mv $i `echo $i | sed 's/Ä/Ae/'`; done
Wednesday, September 5, 2012
Bash script - Delete characters before or after a pettern from string
I have this string:
I want to delete all characters after "?":
the result is: This is a Test. Isn't it
now I want to delete all characters before "a":
Resut: Test. Isn't it? Yes, it is.
MyString="This is a Test. Isn't it? Yes, it is."
I want to delete all characters after "?":
echo $MyString | sed -e 's/?.*//g'
the result is: This is a Test. Isn't it
now I want to delete all characters before "a":
echo $MyString | sed -e 's/.*a//g'
Resut: Test. Isn't it? Yes, it is.
Bash script - Removing duplicated lines from file
Run this command:
awk '!x[$0]++' source.txt > target.txt
Wednesday, August 22, 2012
Using PHP/oci8 to Connect to Oracle Remote DB
With this short PHP script, you can see how I connect to a remote Oracle DB:
<?php
//Connect String
$db="(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)
(HOST=REMOTE_DB_IP)(PORT=XXXX)
)
)
(CONNECT_DATA=(SID=ORACLE_SID))
)";
//Connect to DB
$conn = oci_connect('USERNAME','PASSWORD',$db);
//Run a sample query
$s = oci_parse($conn, 'select * from DB_TABLE');
oci_execute($s);
oci_fetch_all($s, $res);
echo "<pre>\n";
var_dump($res);
echo "</pre>\n";
//Close DB Connection
oci_close($conn);
?>
Installing OCI8 On Debian
OCI8 is an extension for providing APIs to Oracle database management system. You need Apache, PHP and Oracle Instant Client.
Register and Download Oracle Instant Client. Choose your platform compatibility (in my case x64), if the package not compatible with your platform then installation process will failed. At least, we just need Basic and SDK. Then put on /opt/oracle or whatever directory did you liked:
unzip instantclient-basic-linux.x64-11.2.0.3.0.zip
Create symbolic links for dinamic library and Add instant client to system ld:
Compiling OCI8 and enter instantclient,/oracle_client when you are prompted:
Enable oci8 extension on php.ini or add it to php Conf:
and add this line to file:
extension=oci8.so
then restart apache2 web server.
/etc/init.d/apache2 restart
Then check phpinfo() and the successfull installation should be :
When you get this error:
you should install libaio:
apt-get install libaio1
Register and Download Oracle Instant Client. Choose your platform compatibility (in my case x64), if the package not compatible with your platform then installation process will failed. At least, we just need Basic and SDK. Then put on /opt/oracle or whatever directory did you liked:
mkdir /oracle_client
mkdir /opt/oracle
cd /opt/oracle
unzip instantclient-basic-linux.x64-11.2.0.3.0.zip
unzip instantclient-sdk-linux.x64-11.2.0.3.0.zip
mv /opt/instantclient_11_2/* /oracle_client/
Create symbolic links for dinamic library and Add instant client to system ld:
cd /oracle_client
ln -s libclntsh.so.11.1 libclntsh.so
ln -s libocci.so.11.1 libocci.so
Compiling OCI8 and enter instantclient,/oracle_client when you are prompted:
pecl install oci8
Enable oci8 extension on php.ini or add it to php Conf:
vim /etc/php5/conf.d/oci8.ini
and add this line to file:
extension=oci8.so
then restart apache2 web server.
/etc/init.d/apache2 restart
Then check phpinfo() and the successfull installation should be :
When you get this error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/oci8.so' - libaio.so.1: cannot open shared object file: No such file or directory in Unknown on line 0
you should install libaio:
apt-get install libaio1
Tuesday, August 21, 2012
Get an IP address out of fail2ban jail
Removes an iptables rule created by fail2ban. This example shows how to
remove a rule for an IP from the fail2ban-apache chain. Can be used for
any service monitored by fail2ban:
or remove from fail2ban-SSH jail:
iptables -D fail2ban-SSH -s IP_ADDRESS_TO_SET_BE_FREE -j DROP
iptables -D fail2ban-apache -s IP_ADDRESS_TO_SET_BE_FREE -j DROP
or remove from fail2ban-SSH jail:
iptables -D fail2ban-SSH -s IP_ADDRESS_TO_SET_BE_FREE
Monday, August 20, 2012
Resize a VirtualBox hard disk (.VDI) in Linux
I would recommend backing up your current vdi file before doing this!
Run this command in terminal:
It resizes your hard disk to 20GB.
Run this command in terminal:
VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB
Example:
VBoxManage modifyhd MyWindows7.vdi --resize 20000
It resizes your hard disk to 20GB.
Start your guest machine and resize the partition with your suitable tool. (for example: Gparted for Linux or Windows Partition Manager for windows)
Wednesday, August 8, 2012
Block a message by a specific email SUBJECT - PLESK
Custom filter rules can be defined in /etc/mail/spamassassin/local.cf, for example:
The first string defines the match rule. A regular expression is used in 'header' to check the message's subject.
The second string describes the filter.
And the third string defines how much scores should spamassassin set to the matching message.
You can find more info on writing custom rules for spamassassin in Mail::SpamAssassin::Conf manual page:
Source: http://kb.parallels.com/en/1038
header CUSTOM_SUPERSPAM Subject =~ /.*spam subject.*/i
describe CUSTOM_SUPERSPAM Superspam messages
score CUSTOM_SUPERSPAM 100.0
The first string defines the match rule. A regular expression is used in 'header' to check the message's subject.
The second string describes the filter.
And the third string defines how much scores should spamassassin set to the matching message.
You can find more info on writing custom rules for spamassassin in Mail::SpamAssassin::Conf manual page:
# man Mail::SpamAssassin::ConfFriday, July 27, 2012
Piwik 1.8 and import log
In Piwik 1.8 you can import the raw apache logs into piwik from command line:
%PIWIK-ROOT%/misc/log-analytics/import_logs.py --url=http://YOUR-PIWIK-URL LogFileName.log --show-progress --idsite=1
%PIWIK-ROOT%/misc/log-analytics/import_logs.py --url=http://YOUR-PIWIK-URL LogFileName.log --show-progress --idsite=1
mysqldump: Got error: 1044: Access denied for user 'root'@'localhost' to database 'information_schema' when using LOCK TABLES
This error occurs when making MySQL dump:
To solve this problem, add this parameter to mysqldump command:
mysqldump: Got error: 1044: Access denied for user 'root'@'localhost' to database 'information_schema' when using LOCK TABLES
To solve this problem, add this parameter to mysqldump command:
--single-transaction
Friday, July 20, 2012
Plesk - Autoresponder in Cron job
This command could be in cronjob for automtic on/off autoresponder:
for activating:
/usr/local/psa/bin/mail -u YOUR@EMAIL.COM -autostatus true -autoname AUTORESPONSE-NAME -autorsp true
for deactivating:
/usr/local/psa/bin/mail -u YOUR@EMAIL.COM -autostatus false -autoname AUTORESPONSE-NAME -autorsp false
for activating:
/usr/local/psa/bin/mail -u YOUR@EMAIL.COM -autostatus true -autoname AUTORESPONSE-NAME -autorsp true
for deactivating:
/usr/local/psa/bin/mail -u YOUR@EMAIL.COM -autostatus false -autoname AUTORESPONSE-NAME -autorsp false
Subscribe to:
Posts (Atom)
