Wednesday, October 24, 2018

Using Rsync to backup to an external drive

https://serverfault.com/questions/25329/using-rsync-to-backup-to-an-external-drive

use rsync with the following flags handily memorable as 'glop' and 'trunc' and 'v'.
rsync -gloptrunc $srcdir $dstdir
A brief guide:
  • g - preserve group ownership info
  • l - copy symlinks as symlinks
  • o - preserve owner info
  • p - preserve permissions
  • t - preserve timestamps
  • r - recurse thru directories
  • u - update, skip any newer files
  • [n] - no, dont do this, do a dry run instead
  • c - checksum, attempt checksums on file blocks when possible (*)
    note: on local filesystems, this get overridden and entire files are copied instead.
  • v - verbose
Compatible with FAT32:  rsync -rtv src dst

Friday, September 21, 2018

python change path for one dir up, safe method

NEWPATH = os.path.split(OLDPATH.rstrip(os.sep))[0]

Wednesday, September 19, 2018

Recursive chmod with sudo

For directories (which are usually not too many):

sudo chmod 755 $(sudo find path/to/dir -type d)

for files (which are numerous):

find path/to/dir -type f -print0 | sudo xargs -0 chmod 664

Sources:
https://superuser.com/questions/91935/how-to-recursively-chmod-all-directories-except-files
https://www.linuxquestions.org/questions/linux-newbie-8/unable-to-execute-bin-chmod-argument-list-too-long-908143/

Monday, September 17, 2018

KDE disable super_L (windows key) key shortcut as menu launcher

In kde plasma 5.8 the super/win key is also used to trigger the launcher, when pressed and released without combining it with another key. To disable the feature, put
[ModifierOnlyShortcuts]
Meta=
in ~/.config/kwinrc.

https://superuser.com/questions/1156130/kde-disable-super-l-windows-key-key-shortcut-as-menu-luncher

Monday, July 16, 2018

Google Calendar: Change the Default Event Reminders and Alerts

Original post: http://www.tech-recipes.com/rx/2670/google_calendar_change_default_event_reminder/

1.
Log in to your Google Calendar.
2. Click the settings gear in the upper right hand corner. Select the Settings link.
3. Go to the horizontal menu in the upper right and select Settings.
4. Under Calendar Settings, select the Calendars link.
5. Go to the desired calendar on the list of My Calendars. Select the Notifications link for that calendar.
6. Go to the Event reminders section and use the By default, remind me via dropdown and select Email or SMS. You can adjust how much time before the event is provided for the notification to occur. 
7. Below, you can adjust how to be notified for various event actions such as when new events are posted, events are changed, etc. These are very beneficial tools for shared calendars.
8. When you are finished, click the Save button.

Friday, June 29, 2018

Change file associations in KDE


You should just need to, Right click any file in dolphin, go to properties, then file type options. under application preference order, move the app you want to open that file to the top of the list, then click Apply.
All files of that type should now open with the app. you chose.

 https://ubuntuforums.org/showthread.php?t=2287371

Embedded python argv problem

Workaround is to start embedded script with:
 
import sys

if not hasattr(sys, 'argv'):
    sys.argv  = [''] 
 
 https://github.com/google/oauth2client/issues/642

Thursday, June 28, 2018

Imagej / Fiji replace NaN

Use

Process -  Math - Macro



the last zero can be any value

Monday, June 18, 2018

Ubuntu 16 install Teamviewer 12

Bear in mind I have had this installed since 16.04 was in development and now in 16.10.
So some time has passed since then...but I seem to remember struggling with the 64 bit .deb
Went through some old notes and found my install went like this.
Code:
sudo dpkg --add-architecture i386
You have already done this
Code:
sudo apt-get update
And this also is already done
Code:
wget http://download.teamviewer.com/download/teamviewer_i386.deb
I choose the 32bit .deb
Code:
sudo dpkg -i --force-depends teamviewer_i386.deb


In case “dpkg” indicates missing dependencies, complete the installation by executing the following command:

Code:
sudo apt-get install -f
complete the installation by executing the following command:
Code:
sudo teamviewer --daemon start
Source: https://ubuntuforums.org/showthread.php?t=2340067

Sunday, June 17, 2018

Format usb stick / drive using Linux

Get the tool:
sudo apt-get update
sudo apt-get install dosfstools

Mount the stick via GUI
Check its path using:
df -m
(yes there are other more sleek ways to check it)

unmount the drive:
sudo umount /dev/sd<...>

format (FAT32 used as example here):
mkdosfs -F 32 -I /dev/sd<...>

Do not mix up drives, this erases all data irreversibly!

Friday, June 15, 2018

Set older kernel as default grub entry

 
First, make a backup copy of /etc/default/grub. If something goes wrong, you can easily revert to the known-good copy.
 
sudo cp /etc/default/grub /etc/default/grub.bak

Then edit the file using the text editor of your choice (e.g. gedit, etc.).
 
sudo -H gedit /etc/default/grub

Find the line that contains GRUB_DEFAULT - this is what you'll want to edit to set the default. You must know the full name of the kernel you want - e.g. Ubuntu, with 
Linux 3.13.0-53-generic - along with the full name of the "advanced menu" - e.g. Advanced options for Ubuntu.

To list all kernels do:
 dpkg --list | grep linux-image

You then combine those two strings with > and set GRUB_DEFAULT to them as:  

GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 3.13.0-53-generic" (including quotes).

Save it, then build the updated grub menu.
sudo update-grub 

Sources:
https://askubuntu.com/questions/216398/set-older-kernel-as-default-grub-entry
https://www.cyberciti.biz/faq/howto-display-all-installed-linux-kernel-version/

KDE Linux update settings 16.04, prevent automatic updates

Start->System->Update Manager

More...->Advanced->Configure Software Sources

Enter sudo password for current account
In "Software Sources" choose "Updates" tab
Select radio button "Only notify about available updates"

Press “Close”, the choices will be saved this way.
 


Saturday, April 21, 2018

How to set up a single Dropbox folder on dual-boot Windows and Linux system

https://medium.com/@hivickylai/maintain-one-dropbox-folder-with-dual-boot-windows-and-linux-d338d790675a

Friday, April 20, 2018

Keeping git repositories on different hosts in sync

Source: https://softwareengineering.stackexchange.com/questions/195456/keeping-git-repositories-on-different-hosts-in-sync

Yes, that's exactly the beauty of DVCS such as git. You can use any number of different repos with the same state as the one on bitbucket or github.
Even you local copy (the repository on your computer) is usually a full clone of the remote repo.
The only thing you have to do to keep multiple repos in sync is pulling for one (usually called origin or upstream) and pushing to the backup copies.
 
 Unfortunately all is not as shiny. See the cautionary take of KDE near-disaster. That is, make sure the backup does not delete things (branches, repositories, etc.) that were deleted on the backed up server. 

Clone the remote repository, then pull all updates (all branches) to it in regular intervals. A git clone contains the history, it's not like an svn checkout that has only the latest version.

Friday, April 13, 2018

older FIJI Jython scripts won't execute


see full explanation: http://forum.imagej.net/t/jython-isssue-with-if---name-----main--/5544/2

workaround: replace
 
if __name__=='__main__':

with

if __name__ in ['__builtin__', '__main__']:
    

Wednesday, March 14, 2018

Set up multiple signatures in Gmail - Canned Responses lab

-activate the Canned Responses in Settings->Labs
-click the Compose button to open a new message window
-Once your signature is ready, click the down arrow icon and then Canned Reponses>New canned response
-enter a name for your new canned response and click OK

Full instruction:

https://www.mail-signatures.com/articles/how-to-set-up-multiple-signatures-in-gmail/

Tuesday, January 23, 2018

Fiji complex ROIs

Double-click on oval selection to change for brush

Use Plugins->Segmentation->Segmentation Editor to interpolate ROIs between slices