• Not so hermetic
  • Add script to Nautilus in Ubuntu

    Dec 22

    In my previous post, in order to avoid a repetitive task I had to create a new action in Dolphin.

    But now, for jobs reasons, I’m an Ubuntu user. So I should replicate the same behavior in Nautilus.

    Create a file with the name of the action on this path ~/.local/share/nautilus/scripts

    Paste this script

    #!/bin/bash
    
    for line in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
      if [[ "$line" = "" || "$line" = " " ]]; then
        exit
      else
        filename = $(basename $line)
        pdftk $line stamp /data/digital_ocean/tax_id_digital_ocean.pdf output digital_ocean.pdf
      fi
    done
    
    exit0
    

    Add execute permission to the file.

    Restart nautilus

    Done!

    Now, you are going to have an Script submenu with the new action on your right click menu.

  • Create a new Dolphin action in KDE 4

    Nov 27

    Context

    • I hate repetitive tasks.
    • I have to stamp a some PDF’s invoices, in order to fit our local tax office’s requirements.
    • I need to run a command every month in order to accomplish this task.
    • I’m a KDE 4 user.

    Problem

    I needed to find a simple solution to make it easier.

    Solution

    Create the file ~/.kde4/share/kde4/services/ServiceMenus/.desktop and add this content:

    [Desktop Entry]
    Type=Service
    ServiceTypes=KonqPopupMenu/Plugin
    MimeType=application/pdf
    Name=Stamp Digital Ocean Tax ID
    Actions=StampDigitalOceanTaxID;
    X-KDE-StartupNotify=false
    X-KDE-Priority=TopLevel
    
    [Desktop Action StampDigitalOceanTaxID]
    Name=Stamp Digital Ocean Tax ID
    Exec=pdftk %F stamp /data/digital_ocean/tax_id_digital_ocean.pdf output digital_ocean.pdf
    

    This file, add a new action when you press right click over a PDF file. The option will be “Stamp Digital Ocean Tax ID” and execute the command on the last line.

    And that’s it

  • Moving commits from master to a branch

    Jul 16

    Problem

    Sometimes when I start a small fix, I think that is not necessary to put it on a new branch maybe with one commit should be enough. But then, I realize that should be necessary a bigger effort to fix it completely. So, I’d need a new branch. But I’ve already committed one o two commits. What can I do?

    Solution

    Create a new branch on your working directory:

    git branch not-so-simple-feature
    

    Move the master pointer two, three or n commits back (two on this example):

    git reset --hard HEAD~2
    

    Now you can move to the new branch and continue working.

    git checkout not-so-simple-feature
    

  • Recent Articles
    1. Add script to Nautilus in Ubuntu Dec 22
    2. Create a new Dolphin action in KDE 4 Nov 27
    3. Moving commits from master to a branch Jul 16
  • Tags
    1. kde (1)
    2. ubuntu (1)
    3. nautilus (1)
    4. git (1)