postIt

        Post-It sticky notes with PasteBin sense

  • 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
     
  • 4:57 am on June 15, 2011 | 0 | # |
    Tags: ,

    tcpdump default truncate to 68 bytes snapshot length (snaplen). Use -s 0 to capture all packet length

    tcpdump -s 0 -w /tmp/my240.dump -i eth1 port 2000
     
  • 1:52 pm on February 12, 2011 | 0 | # |
    Tags: , ,

    Unix time conversion

    $ EPOCH=1297515579843
    $ echo $EPOCH | cut -c1-10
    1297515579
     
    $ echo $EPOCH | cut -c1-10 | awk '{print strftime("%c",$1)}'
    Sat 12 Feb 2011 07:59:39 PM WIT