Mr Shang

我是一个勤劳的码农,每天在技术的牧场辛勤劳作


导航栏
 » 首页
 » 分类浏览
 » 关于我
 » 我的Github
 » RSS订阅
Group 59

  1. Replace backend gmail to Postmarkapp for Django

    1. Install module of Python Postmark

    Install this module manually from souce inside your environtment: https://github.com/themartorana/python-postmark

    If you work on Django==1.9.*, requirements only mock.

  2. Download recrusive files inside index-of in Linux using wget
    $ wget -r --no-parent --reject "index.html*" http://125.160.17.22/dokumen/IGN/Panduan_OpenOffice.org_2.0/
    

    For me I have to pass the –no-parent option, otherwise it will follow the link in the directory index on my site to the parent directory. So the command would look like this:

    wget -r --no-parent http://mysite.com/configs/.vim/
    
  3. Python Permutations

    This simply how to implement the module of permutations in python.

    >>> from itertools import permutations
    >>> perms = [''.join(p)+"@gmail.com" for p in permutations('abc', 3)]
    >>> for x in range(0, len(perms)):
    ...     print (perms[x])
    ... 
    abc@gmail.com
    acb@gmail.com
    bac@gmail.com
    bca@gmail.com
    cab@gmail.com
    cba@gmail.com
    >>> 
  4. Simple bash scripting for login before open the terminal

    Add this in your file of /etc/bash.bashrc, makesure you logged in as root.

    ### ===============================================
    ### Simple bash scripting for login before open the terminal.
    ### Credit: <Summon Agus> - agus@python.web.id
    ### Location, end script of: /etc/bash.bashrc
    ### ===============================================
    
    while true; do
      # Don't exit at Ctrl-C
      trap "echo" SIGINT
    
      printf "\n"
      echo -n " Who are you guys? "; read -s name;
      if [ "$name" == "agus" ]; then
        reset
        printf "\n Welcome my KING! you are the best!!\n"
        printf " "; date;
        printf " Please start your activity with Basmalah\n\n"
        break
      else
        printf "\n Heey you! why you here!! You are not owner of this machine!\n"
      fi
    done
    
    ### ===============================================
    ### END
    ### ===============================================
© Mr Shang - niceshang[#]outlook.com - Powered by Jekyll.