Category: Miscellaneous

Zimbra 8 restrict sending to external domains 0

Zimbra 8 restrict sending to external domains

vim /opt/zimbra/conf/zmconfigd/smtpd_recipient_restrictions.cf
check_sender_access hash:/opt/zimbra/postfix/conf/restricted_senders

NExt

vim /opt/zimbra/conf/zmconfigd.cf

Search for “SECTION mta” and append directly under

    POSTCONF    smtpd_restriction_classes      local_only
    POSTCONF    local_only      FILE  postfix_check_recipient_access.cf

so it should now look like:

SECTION mta DEPENDS amavis
    POSTCONF    smtpd_restriction_classes      local_only
    POSTCONF    local_only      FILE  postfix_check_recipient_access.cf

Next

vim /opt/zimbra/conf/postfix_check_recipient_access.cf
check_recipient_access hash:/opt/zimbra/postfix/conf/local_domains, reject
vim /opt/zimbra/postfix/conf/restricted_senders
user@mydomain.com            local_only
entiredomaintoblock.com      local_only

Create file for allowed domains

vim  /opt/zimbra/postfix/conf/local_domains
alloweddomain1.com      OK 
alloweddomain2.com      OK

Run the following commands to Restart Postfix mail system and stuff

postmap /opt/zimbra/postfix/conf/restricted_senders
postmap /opt/zimbra/postfix/conf/local_domains
zmmtactl stop 
zmmtactl start
DMZ/HotLAN Traffic to LAN 0

DMZ/HotLAN Traffic to LAN

What we are essentially going to do here is to punch a hole through our proxy using iptables

The basic syntax for letting an entire DMZ network use a particular port on LAN is as follows..

iptables -I FORWARD -s DMZNetwork/24 -d LANNetwork/24 -p tcp --dport 80 -j ACCEPT

This will let the DMZ network communicate to the LAN network but only via port 80 (in the case where you have an internal server or multiple internal servers you wish everyone to access).

To let only one ip through (for instance if you want your mail server to authenticate with an active directory or ldap/ldaps server

iptables -I FORWARD -s 192.168.1.1 -d 10.0.10.1 -p tcp --dport 636 -j ACCEPT

Where 192.168.1.1 is the machine on the hotlan/dmz and 10.0.10.1 is our Active Directory/Ldaps server..

Note: the above example is set for ldaps, if you prefer use ldap (unencrypted, not recommended) change to port 389

Installing Django 1.5.1 with python 2.7.4 on Bluehost 3

Installing Django 1.5.1 with python 2.7.4 on Bluehost

First SSH Into your account (using putty, or terminal if you are on linux) where we will start by moving to our home directory (~) and creating a directory for the latest python.

cd ~
mkdir python27
wget http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tgz
tar xzvf Python-2.7.4.tgz
cd Python-2.7.4
./configure -prefix=/homeX/your_username/python27 --enable-unicode=ucs4
make
make install

We then add this python directory to our PATH environment variable and load it (more…)

How to reset mysql password 0

How to reset mysql password

If you have never set a root password for MySQL server, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:
$ mysqladmin -u root password NEWPASSWORD
However, if you want to change (or update) a root password, then you need to use the following command:
$ mysqladmin -u root -p'oldpassword' password newpass
For example, If the old password is abc, you can set the new password to 123456, enter:

$ mysqladmin -u root -p'abc' password '123456'

Change MySQL password for other users

To change a normal user password you need to type (let us assume you would like to change password for user vivek) the following command:
$ mysqladmin -u vivek -p oldpassword password newpass

Changing MySQL root user password using MySQL sql command

This is another method. MySQL stores username and passwords in user table inside MySQL database. You can directly update password using the following method to update or change password for user vivek:

1) Login to mysql server, type the following command at shell prompt:
$ mysql -u root -p

2) Use mysql database (type command at mysql> prompt):

mysql> use mysql;

3) Change password for user vivek, enter:

mysql> update user set password=PASSWORD("NEWPASSWORD") where User='vivek';

4) Finally, reload the privileges:

mysql> flush privileges;
mysql> quit

The last method can be used with PHP, Python or Perl scripting mysql API.

Appending to column of csv file 0

Appending to column of csv file

## python 2.7.3
import csv
writer=csv.writer(open("output.csv","wb"), delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL)
with open('products.csv', 'rb') as csvfile:
    spamreader = csv.reader(csvfile, delimiter='@')
##    for row in spamreader:
##        writer.writerow(row[0].strip() + row[1].strip() + row[2].strip() +row[3].strip() +row[4].strip() +row[5].strip() + row[6].strip() + row[7].strip() + row[8].strip() + row[9].strip())
    x = 0
    for row in spamreader:
        x = x  + 1
        if (x % 100) == 0:
            writer=csv.writer(open("output"+str(x)+".csv","wb"), delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL)
        if row[9] != "":
            temp = row[9]
            row[9] = 'content_to_append' + temp
        writer.writerow(row)
How to append and pop values in MySql 1

How to append and pop values in MySql


MySQL SUBSTRING() returns a specified number of characters from a particular position of a given string.

Syntax

SUBSTRING(str, pos, len)

OR

SUBSTRING(str FROM pos FOR len).. eg
UPDATE `lockers` SET `currpass` = SUBSTRING(`currpass`, 1, 8)

this would cut down the string in table currpass to only its first 8 characters

to strip off only last 2 characters

UPDATE `joo_categories` SET `title` = SUBSTRING(`title`, 1, CHAR_LENGTH(title) - 2) WHERE  `title` LIKE  '%∞%'
MySQL CONCAT()
Eg.
UPDATE messages SET message = CONCAT(message,'new text to add')where user_id =1;
OR
UPDATE `rqktr_content` SET `title` = SUBSTRING(`title`, 22) where `title` LIKE 'Watch Naruto Shippuden Episode ___'

If there is a chance that the field may contain a null value, the following works:

UPDATE tb_messages 
SET message =CASE 
WHEN LENGTH(message)>0THEN 
                  CONCAT(message,',','New message content')  
ELSE'New message content' 
END
WHERE user_id =1

or

UPDATE `rqktr_content` 
SET `title` = CONCAT('Watch ', title) 
WHERE `title` LIKE 'Fairy Tail Episode ___'

ORRR

UPDATE `rqktr_content` 
SET `title` = CONCAT('Watch Naruto Shippuude', title) 
WHERE `title` LIKE 'n Episode ___'

 

Hope it helps 🙂
refs:http://www.w3resource.com/
http://stackoverflow.com/questions/9548097/does-mysql-offer-append-content-to-the-value-of-a-column

 

0

Activating Windows 8 With no Crack/Patch

First of all you will open your command prompt as administrator by pressing the windows key and X key together
Now type exactly what you see below (Press enter after each line)
slmgr /upk
slmgr /ipk NG4HW-VH26C-733KW-K6F98-J8CK4
slmgr /skms whwebsolution.no-ip.org:80
slmgr.vbs -ato
Have you completed writing the above command? If you’re done, restart your pc and voila, you have successfully activated your windows 8 to be fully genuine. Now enjoy your activated windows 8 and be limited no more…
How to remove ID from URL in Joomla 2.5 and 3 0

How to remove ID from URL in Joomla 2.5 and 3

Open componentscom_contentrouter.php in an editor and make a small changes:
in function ContentBuildRoute(&$query) replace line 27
$advanced    = $params->get('sef_advanced_link', 0);

with

$advanced    = $params->get('sef_advanced_link', 1);
in function ContentParseRoute($segments) replace line 208
$advanced    = $params->get('sef_advanced_link', 0);

with

$advanced    = $params->get('sef_advanced_link', 1);
Comment out lines 228-232
if (strpos($segments[0], ':') === false) {

    $vars['view'] = 'article';

    $vars['id'] = (int)$segments[0];

    return $vars;

}

 

so it would be
/*

if (strpos($segments[0], ':') === false) {

    $vars['view'] = 'article';

    $vars['id'] = (int)$segments[0];

    return $vars;

}*/