[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
it-tricks [2017/10/12 17:32]
popel
it-tricks [2017/10/17 09:04]
ufal [Other]
Line 6: Line 6:
 Feel free to add your name and editor. Feel free to add your name and editor.
  
-  * **vim**: Ondřej Bojar, Ruda Rosa, ...+  * **vim**: Ondřej Bojar, Ruda Rosa, Milan Straka (C++ completion, Python completion, asynchronous make), ...
   * **emacs**: ?   * **emacs**: ?
 +  * **nano**:
   * **atom**: Martin Popel   * **atom**: Martin Popel
 +  * **Kate**: Jonáš Vidra
 +  * **PyCharm**: Petr Bělohlávek
  
 ===== Bash ===== ===== Bash =====
Line 14: Line 17:
   * ''export HISTCONTROL=ignoreboth'' results in bash history ignoring duplicate entries and entries starting with a space.   * ''export HISTCONTROL=ignoreboth'' results in bash history ignoring duplicate entries and entries starting with a space.
  
 +==== Directory-local Bash history ====
 +  * Ondřej Bojar prefers to store the history in each directory in ''.history-bojar''. See ''/home/bojar/diplomka/granty/cracker-2015/mtm-2016-organization/accounts-mtm16/bash-profile-for-ufal-accounts''
 +    * Note that this creates the ".history-your-name" wherever you have write access and some ÚFALers are not happy with this. In addition everyone sees what you did (this may be useful, but be careful).
 +  * Ondřej Dušek (''/home/odusek/.bashrc'') uses a variant more friendly to others, which saves the histories in his home (but does not handle renamed directories):<code>
 +if [ -z "$USER" ]; then
 +    export USER=`whoami`
 +fi
 +
 +# Store all history with times and directories
 +function store_history () {  
 +    history 1 | awk '($2 !~ "^[mr]?cd[0-9a-z]?$") {$1="_T="strftime("%Y%m%d_%H:%M:%S_") PROCINFO["ppid"] "_PWD="  ENVIRON["PWD"] "\t"; $2=gensub("^_T=[-_0-9:]*[ \t]* *", "", 1, $2); $2=gensub("^_P=[^ \t]* *", "", 1, $2); print;}' >> ~/.history-all-$USER
 +}
 +export PROMPT_COMMAND="store_history"
 +
 +# Grep history
 +function dhist (){
 +    DIR=`pwd`
 +    command grep "_PWD=$DIR"$'\t'".*$@" ~/.history-all-$USER | tail -n 30
 +}
 +
 +function hist (){    
 +    if [ "$#" -eq 0 ]; then
 +        tail -n 30 ~/.history-all-$USER
 +    else
 +        command grep "$@" ~/.history-all-$USER | tail -n 30
 +    fi
 +}
 +</code>
 ===== Git ===== ===== Git =====
   * [[https://github.com/magicmonty/bash-git-prompt|bash-git-prompt]] shows e.g. the current branch and status. Martin Popel prefers to configure it (in bashrc) with   * [[https://github.com/magicmonty/bash-git-prompt|bash-git-prompt]] shows e.g. the current branch and status. Martin Popel prefers to configure it (in bashrc) with
Line 26: Line 57:
  
 ===== Other ===== ===== Other =====
-  * When using **Perl** at ÚFAL, we recommend using [[Perlbrew]] with shared perl interpreters (different versions) and shared Perl modules (which otherwise take several hours to install).+  * When using **Perl** at ÚFAL, we recommend using [[Perlbrew]] with shared perl interpreters (different versions) and shared Perl modules (which otherwise take several hours to install and 6GB).
   * See [[Python]] for using **Python** at ÚFAL.   * See [[Python]] for using **Python** at ÚFAL.
   * See [[internal:remote access]], esp. for byobu and mosh.   * See [[internal:remote access]], esp. for byobu and mosh.
   * You **should not turn off** Linux workstations at ÚFAL, unless really needed (or agreed with it@ufal). In that case, try the standard ways, and if they do not work, try Ctrl+Alt+SysRq+[R,E,I,S,U,B] rather than plug out power cable. Mnemonics: "Reboot Even If System Utterly Broken", see http://en.wikipedia.org/wiki/Magic_SysRq_key#Uses   * You **should not turn off** Linux workstations at ÚFAL, unless really needed (or agreed with it@ufal). In that case, try the standard ways, and if they do not work, try Ctrl+Alt+SysRq+[R,E,I,S,U,B] rather than plug out power cable. Mnemonics: "Reboot Even If System Utterly Broken", see http://en.wikipedia.org/wiki/Magic_SysRq_key#Uses
   * Ondřej Bojar has implemented many [[http://www1.cuni.cz/~obo/textutils/|Text utils]], which he likes to use in his scripts and advises his students to do so as well.   * Ondřej Bojar has implemented many [[http://www1.cuni.cz/~obo/textutils/|Text utils]], which he likes to use in his scripts and advises his students to do so as well.
 +    * The web versions of the text utils are often older than the ones in ''/home/bojar/tools/vimtext'' and ''/home/bojar/tools/shell''
 +  * [[http://mg.readthedocs.io/latexmk.html|latexmk]] can be used with ''-pdf -pvc'', so whenever you save a ''tex'' file, the corresponding ''pdf'' will be regenerated (and your pdf viewer will refresh). Other useful options are ''-interaction=nonstopmode -synctex=1'', see e.g. [[https://tex.stackexchange.com/questions/118489/what-exactly-is-synctex|synctex]]
 +  * [[https://www.pdflabs.com/docs/pdftk-cli-examples/|pdftk]] for merging and splitting pdf files (and much more) from the command line
 +  * shuf
  

[ Back to the navigation ] [ Back to the content ]