Sign up to create your own snipts, or login.

Public snipts » robertbanh's snipts » linux The latest linux snipts from robertbanh.

showing 1-9 of 9 snipts for linux
  • .htaccess file to lock down files with db or secure in the prefix
    <FilesMatch "^(db|secure).*$">
    deny from all
    </FilesMatch>
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Mar 02, 2010 at 11:17 a.m. EST
  • Enable SOAP on Media Temple DV server
    # Navigate to a relatively unimportant directory. I chose /home/
    cd /home/
    
    # Download PHP (http://www.php.net/releases/)
    wget http://museum.php.net/php5/php-5.2.6.tar.gz
    
    # Unpack the PHP file
    tar -zxf php-5.2.6.tar.gz
    
    # Configure the new PHP to enable SOAP (will take a few minutes) (before enable is two dashes)
    cd php-5.2.6
    ./configure --enable-soap=shared
    
    # Rebuild PHP (this will also take a while)
    make
    
    # Copy just the SOAP module into your existing installation of PHP
    cp modules/soap.so /usr/lib/php/modules/
    
    # Add the new SOAP configuration to your existing configuration
    echo "extension=soap.so" > /etc/php.d/soap.ini
    
    # Restart Apache
    /etc/init.d/httpd restart
    
    # Optional: You can now delete /home/php-5.2.6/ if you’d like, as you won’t need it any longer.
    rm -rf /home/php-5.2.6/
    
    # Check phpinfo() to confirm that SOAP is now enabled.
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Feb 22, 2010 at 8:45 p.m. EST
  • Cron job example
    # This will kick off a cron job at 2:07am.
    
    which $EDITOR
    EDITOR=vi
    export EDITOR
    
    crontab -e
    
    MAILTO="bbb@bbb.com"
    7 2 * * * /usr/local/bin/php -f /home/bbb/cron.php
    
    
    crontab -l
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Feb 17, 2010 at 2:45 p.m. EST
  • Rewrite .cfm files to files with .cfm
    RewriteEngine On
    Options -Indexes
    
    # redirect all .cfm files to files without .cfm
    RedirectMatch 301 ^(.*)\index.cfm$ $1
    RedirectMatch 301 ^(.*)\.cfm$ $1
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Feb 15, 2010 at 11:25 a.m. EST
  • Set up mail forwarding on linux
    # add a .forward file to your home directory
    touch .forward
    
    # add your email address
    vi .forward
    <user>@<mail>.com
    
    # change permission else it won't work
    chmod 600 .forward
    
    # test mail send, replace 'user' with your login
    mailx -s 'test from cluster' user < /dev/null
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Dec 17, 2009 at 10:19 a.m. EST
  • My Custom .htaccess file
    RewriteEngine On
    #comment out the options followsymlinks when in prod
    #Options +ExecCGI +FollowSymLinks
    RewriteBase /rbanh/blah/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [L,QSA]
    
    # prevent directory browsing
    Options -Indexes
    
    <FilesMatch "\.(htaccess|svn|xml|inc|.*sql|cache_|.*~)$">
        deny from all
    </FilesMatch>
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Dec 08, 2009 at 10:21 a.m. EST
  • remove newline chars in vi
    :%s/^v<Carriage Return>//g
    
    *hit the ctrl key + v then hit the carriage return.
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Dec 04, 2009 at 2:57 p.m. EST
  • linux AT command
    // linux at command
    
    > at 03:30 -v
    > nohup php -f /x/x/x.php > /x/x/logs
    > nohup php -f /rg/repos/trunk/import/importxx-2009.php > ~rbanh/importlogs2009
    > (Ctrl+D)
    > atq    // to view queue
    > atrm 1 // cancel job 1
    > at 1am tomorrow -v // tomorrow 1am
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Nov 08, 2009 at 7:39 p.m. EST
  • recursive command to perform sudo actions
    // linux: recursive command to perform sudo actions
    
    find . -print  | sed -e 's/^/\"/' -e 's/$/\"/' | xargs sudo ...
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Nov 08, 2009 at 7:35 p.m. EST
Sign up to create your own snipts, or login.