Archive for the 'Software' category

Split screen panes

published on January 17, 2020.

I’ve been using screen a lot more recently, but not enough to have all the commands in muscle memory. Writing down a quick cheat-sheet for working with split panes/windows.

To split a screen pane horizontally: Ctrl+a Shift+s.

To split a screen pane vertically: Ctrl+a Shift+\.

To move between panes: Ctrl+a Ctrl+Tab.

To start a new command line in a pane: Ctrl+a Ctrl+c.

To close the focused pane: Ctrl+a Shift+x.

Save the layout of the panes with: Ctrl+a : and then type layout save name-of-your-layout. After reattaching to the screen session the panes will be restored.

Happy hackin’!

Versions used for examples: screen 4.6.
Tags: screen, split, panes, windows.
Categories: Software, Development.

Attach to an already attached screen

published on January 09, 2020.

Today I ran into a strange error with screen. I was working on a remote server, executing commands in screen when my connection got dropped. I reconnected, wanted to reattach to my screen session with the usual -r option:

screen -r foo

But this greeted me with an error of:

There is a screen on:	(Attached)
There is no screen to be resumed matching foo.

screen -ls confirms there is a screen session for “foo”. Apparently I came back to the server so quick that screen didn’t realize I got dropped from the session and it still thought I was there.

The solution is to run the screen command with -rd:

screen -rd foo

This tells screen to first detach the session and then reattach to it.

Another solution is to run the screen command with -x:

screen -x foo

This tells screen to reattach to an already attached session.

Happy hackin’!

Tags: screen.
Categories: Software, Development.

Delete lines containing a pattern in vim

published on January 08, 2020.

Today I had to delete all lines from a CSV file where the last column has a 1:


While short, I can’t remember this syntax as I have to search for it every time. I’ll try to remember this as “grep for a pattern, and delete” for next time.

Happy hackin’!

Tags: vim, grep, delete.
Categories: Software, Development.

Filter git diff by type of change

published on January 02, 2020.

Yesterday I was looking at a rather large diff, but for the type of change I was after, I wanted to look only at the newly added files. Turns out, git diff has a filtering option with --diff-filter.

The possible values for the --diff-filter are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), type changed (T), Unmerged (U), Unknown (X), and some kind of a Broken (B) file(?).

Running git diff --diff-filter=A will show the diff only for the added files.

These filtering options can also be provided with lowercase, in which case it will behave as an exclude filter. git diff --diff-filter=a will show the diff for all files, except for added ones.

Happy hackin’ and a happy new year!

Versions used for examples: git 2.17.
Tags: git, diff, filter.
Categories: Development, Software.

PhpStorm previous version settings not imported

published on March 29, 2019.

PhpStorm 2019.1 was released yesterday. During the first run after the upgrade PhpStorm usually asks from what previous version would I like to import the settings from, but this time it didn’t ask that. It rather imported some of my old settings, but not the latest ones I had for 2018.3.

I’ve tried to import old settings from the “Import settings” menu, but whatever version I chose, it said something about “can’t find”.

Turns out the fix is to delete the settings folder for the newest version, in my case under Ubuntu it’s the ~/.PhpStorm2019.1 folder, start PhpStorm again and this time it should ask about which older settings to import.

Not sure why this happened, it might be due to the fact that I have installed and updated PhpStorm with snap? In any case, it’s fixed now.

Happy hackin’!

Tags: phpstorm, php, settings, ide.
Categories: Software, Development.
Robert Basic

Robert Basic

Software developer making web applications better.

Let's work together!

I would like to help you make your web application better.

Robert Basic © 2008 — 2020
Get the feed