Skip to content

Instantly share code, notes, and snippets.

@yulijia
Last active August 29, 2015 14:04

Revisions

  1. yulijia revised this gist Jul 23, 2014. 3 changed files with 6 additions and 2 deletions.
    1 change: 1 addition & 0 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    alias count='ll -h ./ |grep "^-" |wc -l'
    alias win7='cd /run/media/root'
    alias vi='vim'


    __pl() { /root/bin/codefile.sh $1 "pl"; };
    1 change: 1 addition & 0 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    au BufRead,BufNewFile *.md set filetype=markdown
    6 changes: 4 additions & 2 deletions codefile.sh
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,8 @@ elif [[ "$2" == "pl" ]] ; then
    echo "# DESCRPTION: " >> $1.$2
    echo "# " >> $1.$2
    echo "# " >> $1.$2
    gedit $1.$2
    # gedit $1.$2
    vi $1.$2
    :
    elif [[ "$2" == "md" ]] ; then
    touch $1.$2
    @@ -38,7 +39,8 @@ elif [[ "$2" == "r" ]] ; then
    echo "# DESCRPTION: " >> $1.R
    echo "# " >> $1.R
    echo "# " >> $1.R
    gedit $1.R
    # gedit $1.R
    vi $1.R
    :
    #elif [[ "$2" == "py" ]] ; then
    # touch $1.$2
  2. yulijia created this gist Jul 23, 2014.
    12 changes: 12 additions & 0 deletions .bashrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    alias count='ll -h ./ |grep "^-" |wc -l'
    alias win7='cd /run/media/root'


    __pl() { /root/bin/codefile.sh $1 "pl"; };
    alias pl='__pl'

    __md() { codefile.sh $1 "md"; };
    alias md='__md'

    __r() { codefile.sh $1 "r"; };
    alias r='__r'
    52 changes: 52 additions & 0 deletions codefile.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    #!/bin/bash

    time=`date`
    authorname=`whoami`


    if [[ -z $1 ]] ; then
    echo $"couldn't find filename, please give a filename"
    elif [[ "$2" == "pl" ]] ; then
    touch $1.$2
    echo "#!/usr/bin/perl -w" >> $1.$2
    echo " " >> $1.$2
    echo "# CODE_NAME: $1" >> $1.$2
    echo "# DATE: $time" >> $1.$2
    echo "# AUTHOR: $authorname" >> $1.$2
    echo "# DESCRPTION: " >> $1.$2
    echo "# " >> $1.$2
    echo "# " >> $1.$2
    gedit $1.$2
    :
    elif [[ "$2" == "md" ]] ; then
    touch $1.$2
    echo "<!--" >> $1.$2
    echo "# CODE_NAME: $1" >> $1.$2
    echo "# DATE: $time" >> $1.$2
    echo "# AUTHOR: $authorname" >> $1.$2
    echo "# DESCRPTION: " >> $1.$2
    echo "# " >> $1.$2
    echo "# " >> $1.$2
    echo "-->" >> $1.$2
    gedit $1.$2
    :
    elif [[ "$2" == "r" ]] ; then
    touch $1.R
    echo "# CODE_NAME: $1" >> $1.R
    echo "# DATE: $time" >> $1.R
    echo "# AUTHOR: $authorijia" >> $1.R
    echo "# DESCRPTION: " >> $1.R
    echo "# " >> $1.R
    echo "# " >> $1.R
    gedit $1.R
    :
    #elif [[ "$2" == "py" ]] ; then
    # touch $1.$2
    # echo "<!--" >> $1.$2
    # echo "# CODE_NAME: $1" >> $1.$2
    # echo "# DATE: $time" >> $1.$2
    # echo "# AUTHOR: $authorijia" >> $1.$2
    # echo "# DESCRPTION: " >> $1.$2
    # echo "# " >> $1.$2
    # echo "# " >> $1.$2
    codefile.sh