postIt

        Post-It sticky notes with PasteBin sense

  • 10:29 am on April 11, 2013 | 0 | # |
    Tags: , , ,

    Change internet default route in Mac OS X to USB HSDPA modem stick with LAN’ certain subnet routed via a gateway in WiFi (en1).

    In my case DNS will go with the modem interface setting remain routed via USB modem stick

    before routing:

    $ netstat -nr
     
    Routing tables
     
    Internet:
    Destination        Gateway            Flags        Refs      Use   Netif Expire
    default            10.64.64.64        UGSc           72      137    ppp0
    default            link#4             UCSI            0        0     en0
    default            10.1.1.1          UGScI           0        0     en1

    Delete and add routes (desired LAN subnet 192.168.1.0/24:

    sudo route -n delete default 10.1.1.1
    sudo route -n add default 10.64.64.64
    sudo route -n add 192.168.1.0/24 10.1.1.1

    after routing:

    $ netstat -nr
     
    Routing tables
     
    Internet:
    Destination        Gateway            Flags        Refs      Use   Netif Expire
    default            10.64.64.64        UGSc           21        0    ppp0
    default            link#4             UCSI            0        0     en0
    default            10.1.1.1          UGScI           0        0     en1
    10.1.1/24         link#5             UCS             6        0     en1
    ...
    192.168.1         10.1.1.1          UGSc            0        0     en1
    ...
     
  • 5:31 pm on February 12, 2013 | 0 | # |
    Tags: , ,

    Check apache2 enabled modules:

    $ sudo apache2ctl -M
    Loaded Modules:
     core_module (static)
     log_config_module (static)
     logio_module (static)
     mpm_prefork_module (static)
     ...

    mod_rewrite (rewrite_module usually manipulated in .htaccess) and ssl (for HTTPS) for examples aren’t enabled by default in Ubuntu’ installation of apache2.

    Enable one or more of them via:

    $ sudo a2enmod
     
  • 11:31 am on July 19, 2012 | 0 | # |
    Tags: , ,

    Restoring a production database into VM and change date to make it looks like some point of time inside the production server i.e. in this case May 4, 2010

    $ /etc/init.d/mysqld stop
    $ /etc/init.d/httpd stop
    $ date +%D -s 2010-05-04
    $ date +%T -s 23:00:00 -u

    Check date

    $ date
    Tue May  4 19:00:01 EDT 2010

    Import database

    /etc/init.d/mysqld start
    /etc/init.d/httpd start
    mysql -u some-username -p < some-db.sql

    Note: Hardware clock option in the VirtualBox VM setting is disabled

     
  • 11:49 am on March 8, 2012 | 0 | # |
    Tags: , ,

    Check ssh key RSA fingerprint:

    $ ssh-keygen -l -f /home/myusername/.ssh/id_rsa.pub
    7b:e5:6f:a7:xx:xx:xx:xx:xx:xx:xx:xx:8b:57:xx:xx /home/myusername/.ssh/id_rsa.pub (RSA)
     
  • 8:35 am on January 28, 2012 | 0 | # |
    Tags: , ,

    Running separate version of wine in separate config directory (to isolate errors of running or installation failure)

    env WINEPREFIX="/home/arif/.wine-newapps" /usr/local/bin/wine-1.1.31/usr/bin/wine /home/arif/.wine-newapps/drive_c/Program\ Files/newapps/newapps.exe
     
  • 1:44 pm on January 25, 2012 | 0 | # |
    Tags: ,

    grep omit empty lines:

    cat <something> | grep -v "^$"

    I keep forgetting this regexp of “match expression at the star of the line”: the “^”

     
  • 9:50 am on January 11, 2012 | 0 | # |
    Tags: ,

    Custom run level init.d script:

    startup script on run level 0 and 6, as 34th start only e.g.

    update-rc.d which-tty start 34 0 6 .

    will create

    /etc/rc0.d/S34which-tty
    /etc/rc6.d/S34which-tty
     
  • 6:39 am on January 10, 2012 | 0 | # |
    Tags: ,

    Checking whether /dev/video0 or /dev/ttyUSB0 exists or not (module is installed & probed). They're recognized as "character special file" in bash

    [ -b /dev/ttyUSB0 ] && echo "char special file found" || echo "char special file not found"

    Compare the above to "block special file"

    [ -b /dev/sda ] && echo "block special file found" || echo "block special file not found"
     
  • 8:03 am on August 10, 2011 | 0 | # |
    Tags: , , ,

    Socket monitoring by watching receive and send queue every 5 seconds

    $ while true; do netstat -tn; sleep 5; clear; done

    Result:

     
    Active Internet connections (w/o servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State
    tcp        0      0 10.238.133.152:43941    98.136.48.103:5050      ESTABLISHED
    tcp        1      0 10.238.133.152:42541    8.27.254.249:80         CLOSE_WAIT
    tcp        1      0 10.238.133.152:34355    184.73.222.16:80        CLOSE_WAIT
    tcp        0      0 10.238.133.152:43210    199.59.148.87:443       ESTABLISHED
    tcp        0    229 10.238.133.152:43209    199.59.148.87:443       ESTABLISHED

    This is to emulate combination of watch and ss in Solaris, more or less same result

    $ watch -n 5 ss -t
    State      Recv-Q Send-Q      Local Address:Port          Peer Address:Port
    ESTAB      0      0          10.238.133.152:36045       74.125.224.250:https
    ESTAB      0      0          10.238.133.152:36044       74.125.224.250:https
    CLOSE-WAIT 1      0          10.238.133.152:59622      174.129.233.179:www
    ESTAB      0      0          10.238.133.152:43941        98.136.48.103:mmcc
    CLOSE-WAIT 38     0          10.238.133.152:49300        199.59.148.87:https
    ESTAB      0      0          10.238.133.152:33626       74.125.224.191:https
    CLOSE-WAIT 1      0          10.238.133.152:37621        208.46.163.81:www
     
  • 4:30 am on July 12, 2011 | 0 | # |
    Tags: ,

    Krusader crash giving signal 11:
    1. replace .kde/share/config/krusaderrc with original one from initial installation
    2. remove other files under it

    When installing new, we only need to copy :

    $ ls .kde/share/apps/krusader/
    krusaderui.rc    useractions.xml