Improve everyday.

case-insensitive-autocompletion.md

|

Problem : can be cool to autocomplete “doc[tab]” even if the folder is named “Documents” Goal : We are going to modify .inputrc

Setup :

  • check if you already have a .inputrc in your home (if not create it)
  • add the following line :
    set completion-ignore-case On
    
  • open new terminal, should be ok

building-tensorflow.md

|

Building Tensorflow from sources

Sandbox issue

If the command:

bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer

fails with

src/main/tools/namespace-sandbox.c:545: mount("none", "/", NULL, MS_REC | MS_PRIVATE, NULL): Permission denied

then add the options --spawn_strategy=stsndalone --genrule_strategy=standalone

bazel build -c opt --config=cuda --spawn_strategy=standalone --genrule_strategy=standalone //tensorflow/cc:tutorials_example_trainer

source: https://github.com/bazelbuild/bazel/issues/418

timing-with-timeit.md

|

Timing execution with timeit

Using the module timeit we can time the execution of pieces of code, and repeat the process <number> times.

Here is an example from the Reminiz_experiments/datasets/rcmd.py script:

import timeit

...RCMD class definition...

def time_func(call, setup, nb_repeat=3):
  t = timeit.timeit(call, setup=setup, number=nb_repeat)
  avg_t = t / nb_repeat
  s = '%.6f s  in average for "%s"' % (avg_t, call)
  return s
if __name__ == "__main__":
  setup = 'from __main__ import RCMD\nrcmd = RCMD()'
  nb_repeat = 3 
  calls_to_time = [ 
    'rcmd.actorToTracks(23)',
    'rcmd.movieToTracks(22)',
    'rcmd.idsToPaths(1)', 
    'rcmd.idsToPaths([1, 1000, 10000, 100000, 1000000, 10000000])',
    'rcmd.trackToIds(155)']
  for call in calls_to_time:
    print(time_func(call, setup, nb_repeat=nb_repeat)) 

Output:

0.020010 s  in average for "rcmd.actorToTracks(23)"
0.020802 s  in average for "rcmd.movieToTracks(22)"
0.000094 s  in average for "rcmd.idsToPaths(1)"
0.000306 s  in average for "rcmd.idsToPaths([1, 1000, 10000, 100000, 1000000, 10000000])"
1.334021 s  in average for "rcmd.trackToIds(155)"

set-tab-title.md

|

Set the title of tabs in the terminal

Add the following function to your .bashrc:

function set-title() {
  if [[ -z "$ORIG" ]]; then
    ORIG=$PS1
  fi
  TITLE="\[\e]2;$@\a\]"
  PS1=${ORIG}${TITLE}
}

Then you can change the name of a tab using set-title <my title>. It supports spaces in titles.

source: http://unix.stackexchange.com/questions/177572/how-to-rename-terminal-tab-title-in-gnome-terminal

color-active-tab.md

|

Coloring the active tab

  1. Create the file ~/.config/gtk-3.0/gtk.css

  2. Write in it:

TerminalWindow .notebook tab:active {
    background-color: #def;
}

See colors in HTML for a list of colors.

source: http://askubuntu.com/questions/40332/how-to-make-selected-tab-in-terminal-more-prominent