Posts

Showing posts from 2018

awk delimiters

I have been using awk for a while and I had a use case where I wanted to use multiple delimiter, ' ' being one of them. If its just space, we can use : awk -F' ' '{print $2}' If its bunch of characters, we can use : awk -F'[.:]' '{print $2}'  But with space, we need to use as follows : awk -F'[[:space:].]+' '{print $2}' I have not been able to figure out to associate '+' only to space. But for now this will server the purpose as long as I can combine multiple '.' Some other classes are: [[:blank:][:cntrl:]]  [ \t,:;]

Python notebook shortcuts

Recently started using a lot of notebook and keep struggling to remember shortcuts. So posting here so that I'll remember few important ones. Ctrl + Enter : Execute current cell Ctrl + / : multi-line comment Ctrl + Shift + - : Split cell Shift + m : Merge cells a : Above current cell, create a cell b : Below current cell, create a cell

Linux mint suspend after more than 1 hour

Trying to determine ideal time for suspending the machine but found that maximum time Linux mint allows before it can suspend the machine is 1 hour. After researching a bit, found that we can extend this time. These are the commends : sudo apt-get install dconf-editor Open Menu->dcong-editor In dconf-editor, org > cinnamon > settings-daemon > plugins > power and manually set the value for the "sleep-inactive-ac-timeout" (it's in seconds)

Installing new packages behind proxy

There are 2 main ways to do this : pip install pandas python -m pip install pandas --proxy proxy..com:3128 Second option has many other parameters which can be passed. For installing via notebook, we can do as follows : import sys !{sys.executable} -m pip install numpy !{sys.executable} -m pip list --user 

Converting screen into tmux ( terminal multiplexer )

We have beutiful program called tmux which allows us to see multiple terminal windows at the same time. We can covert screen in doing something similar. To split vertically: ctrl + a then |. To split horizontally: ctrl + a then S (uppercase 's'). To unsplit: ctrl + a then Q (uppercase 'q'). To switch from one to the other: ctrl + a then tab We can save layouts in screenrc so that we wont have to keep doing this as well.

Shell keyboard shortcuts

On Linux shell, imagine you are executing a long command and then you remember that you need to execute other command first. Just found out an awesome feature where you can put a command in buffer (Ctrl+U), execute another command and then retrieve the buffer(Ctrl+Y). Awesome! Of course, Ctrl+A (Ctrl+A+A when you are in screen) to take you to the start of the line and Crtl+E to take you to end of the line.