A random collection

Archive for the ‘tech-tips’ Category

TECH: Eclipse 101

Getting started with Eclipse


  1. Download “Eclipse IDE for Java Developers” from
  2. Add following packages
    1. EPP Java Feature
    2. EPP Modeling Feature
    3. EPP CPP Feature
    4. Java EE IDE Feature
    5. MDT Papyrus – Runtime and Tools (Incubation)
    6. PyDev from, see instructions at

Written by curious

April 10, 2012 at 12:05 pm

Posted in tech-tips

TECH: Configure nginx httpd

Install and configure nginx on Fedora

  1. Deny access to all “/.ht*” files
                location ~ .*/\.ht {
                    deny all;;
  2. Enable public_html access. Add these in /etc/nginx/conf.d/default.conf
                location ~ ^/~(.+?)(/.*)?$ {
                    alias /home/$1/public_html$2;
  3. Add authentication
                location ~ ^/~someuser/v/(.*)$ {
                    alias /home/someuser/public_html/v/$1;
                    auth_basic "Restricted";
                    auth_basic_user_file /home/someuser/public_html/v/.htpasswd;
  4. Create password: htpasswd -c /home/someuser/public_html/v/.htpasswd
  5. Enable nginx
            systemctl enable nginx.service
            systemctl start nginx.service

Written by curious

November 17, 2011 at 12:44 pm

Posted in tech-tips

TECH: Enable SSHd on Fedora Linux (systemd)

Fedora now uses systemd package to manage service start ups. In order to enable sshd in it:

systemctl start sshd.service
systemctl enable sshd.service

Do not forget to fix iptables to allow ssh traffic. Add the following line in /etc/system/iptables file

-A INPUT -m state --state NEW -m tcp -p tcp -s --dport 22 -j ACCEPT

Written by curious

November 12, 2011 at 10:54 pm

Posted in linux

TECH: Encrypting a file

  1. In order to encrypt a file
    openssl des3 -e -k opensesame -in inputfile.tar -out outputfile.des3
    openssl aes-256-cbc -e -salt -k password -in inputfile.tar -out outputfile.enc
  2. In order to decrypt a file
    openssl des3 -d -k opensesame -in outputfile.des3 -out inputfile.tar
    openssl aes-256-cbc -d -salt -k password -in outputfile.dec -out origfile.tar
  3. Decrypt, Gunzip, untar in 1 step (and vice versa)
    openssl des3 -d -k opensesame -in input.tgz.des3  | gzip -c -d - | tar -xf -
    tar -cf - contentsDir | gzip -c - | openssl des3 -e -k opensesame -out output.tgz.des3

Written by curious

July 27, 2011 at 1:12 pm

Posted in tech-tips

TECH: SQL Variables

Need to use variables in your SQL script in SQL Server Management Studio. Here you go:

DECLARE @Commodity int
DECLARE @SettleDate datetime

SET @Commodity = 35
SET @SettleDate = '6/14/2011'

SELECT * FROM SettlePrices
WHERE CommodityId = @Commodity
    AND SettleDate = @SettleDate

Written by curious

June 15, 2011 at 3:43 pm

Posted in databases

TECH: Vim Folding

My ~/_vimrc file

set expandtab
set ts=4
set sw=4
set textwidth=80
set ai

au BufWinLeave * silent! mkview
au BufWinEnter * silent! loadview

set nobackup
set nowritebackup
set directory=c:\temp\junk
set viewdir=c:\temp\junk
  1. No tabs, just spaces
    set ts=4
    set sw=4
    set expandtab
  2. No backups, clean up swaps
    set nobackup
    set nowritebackup
    set directory=c:\temp
  3. Folding Commands
    zfNj creates a fold from the cursor down N lines
    zf/string creates a fold from the cursor to string
    za toggle fold at the cursor
    zj moves the cursor to the next fold
    zk moves the cursor to the previous fold
    zo opens a fold at the cursor
    zO opens all folds at the cursor
    zm increases the foldlevel by one
    zM closes all open folds
    zr decreases the foldlevel by one
    zR decreases the foldlevel to zero -- all folds will be open
    zd deletes the fold at the cursor
    zE deletes all folds
    [z move to start of open fold
    ]z move to end of open fold
  4. Automatically save folds. Put the following lines in your $HOME/.vimrc
    set viewdir=c:\temp
    au BufWinLeave * mkview
    au BufWinEnter * silent loadview
    au BufWinLeave *notes.txt silent! mkview
    au BufWinEnter *notes.txt silent! loadview
  5. Running programs without having to press enter
    :silent !pdflatex -quiet %

    or better run it asynchronously

    :!start pdflatex -quiet %

Written by curious

April 27, 2011 at 9:10 am

Posted in linux

LINUX: Squid Logs

How can I print squid logs with nicer time stamps?

tail -f /var/log/squid/access.log|perl -p -e 's/^([0-9]*)/"[".localtime($1)."]"/e'

Written by curious

April 26, 2011 at 10:37 am

Posted in linux