zngguvnf's Blog

Create space on your hard disk

<2018-03-21>

Today was the day again, my hard drive was full and I had the choice:

  1. Buy a new hard disk and rest for the next few years
  2. Delete some old files and save a lot of money

I finally decided to delete some files and it was easier than I thought.

Summarize disk usage and sort the results:

du -ah | sort -h

With this output in mind, you can concentrate on the large files and folders. I could quickly find and delete many large duplicate folders and large files that I no longer needed.

To check your free disk space:

df -h

Remember to make backups before you delete files

Comments

If you have comments, questions or opinions please drop me a line at blog AT zngguvnf dot org. Please tell me whether it's ok to publish your comment here or not.

Building Signal-Desktop from source

<2018-02-25>

Update [2018-06-11 Mon]

In the following lines I will explain how I managed to build signal-desktop from source.

Since there aren't any official packages for rpm based distros like fedora I decided to build Signal from source.

Install dependencies:

sudo dnf install npm
sudo dnf install libXScrnSaver
sudo dnf install gcc-c++

Clone the repository:

git clone https://github.com/signalapp/Signal-Desktop.git ~/.gitware/Signal-Desktop

Checkout the branch you want to build: (I like to build the latest tag-release. Right now v1.3.0 v1.12.0 is the latest version)

cd Signal-Desktop
git checkout tags/v1.3.0

Build the electron app:

# npm install  # outdated
# npm run dist-prod # outdated
npm install yarn
yarn install
yarn generate
yarn build-release

When the build process is finished you can start signal-desktop:

# ./dist/linux-unpacked/signal-desktop # outdated
./release/linux-unpacked/signal-desktop

To create an app launcher: Create a symbolic link:

# sudo ln -s ~/.gitware/Signal-Desktop/dist/linux-unpacked/signal-desktop /usr/local/bin/signal-desktop
sudo ln -s ~/.gitware/Signal-Desktop/release/linux-unpacked/signal-desktop /usr/local/bin/signal-desktop

Copy the icon:

sudo cp ~/.gitware/Signal-Desktop/images/icon_250.png /usr/local/share/icons/signal.png

(If the directory /usr/local/share/icons does not exsist yet, create it sudo mkdir /usr/local/share/icons/)

With the editor of your choice (you might want to use emacs or nano over vim) create a signal.desktop file:

sudo vi /usr/local/share/applications/signal.desktop

Enter the the following content:

[Desktop Entry]
Name=Signal
Comment=Private messaging from your desktop
Exec="signal-desktop" %U
Terminal=false
Type=Application
Icon=signal.png
StartupWMClass=Signal

That's it. Close the file and open Signal from your launcher.

Please remember that you are responsible for updating the app yourself. To update the app:

git checkout tags/vNewVersion
# npm install
# npm run dist-prod
yarn generate
yarn build-release

To verify your version open the Signal -> Help -> About Signal Desktop

Comments

If you have comments, questions or opinions please drop me a line at blog AT zngguvnf dot org. Please tell me whether it's ok to publish your comment here or not.

Ubuntu 17.10 and CiscoAnyconnect

<2017-12-04>

tl;dr

If you are running Ubuntu 17.10 and fail to install/start Cisco Anyconnect (version 4.5.0.2033):

sudo apt install libpangox-1.0-0

fixed it for me.

The whole story

To login into the virtual private network (VPN) of my university you need to install CiscoAnyconnect.

So I downloaded the installer from the university page and installed it

./anyconnect-linux64-4.5.02033-core-vpn-webdeploy-k9.sh

(Actually this is not the latest version. On the Cisco page you can find version 4.5.02036 but I don't know if this changes anything.)

After the installation an icon "Cisco Anyconnect" appeared in my starter but nothing happend when I clicked the icon. No new window, no error message, nothing.

So I had a closer look:

There was a log file in /tmp/ which told me that the everything was installed to /opt/cisco/anyconnect/.

If you cd to /opt/cisco/anyconnect/bin and run

./vpn

you can configure your VPN using the command line.

So it looks like there is something broken with the ui. Nevertheless, for me this workaround fixes all my problems.

But maybe we can fix the ui, too.

In /opt/cisco/anyconnect/bin there is a file called vpnui. Let's give it a try:

./vpnui
./vpnui: error while loading shared libraries: libpangox-1.0.so.0: cannot open shared object file: No such file or directory

So now we have an error message!

Let's see how to fix this:

apt search libpangox
Sorting... Done
Full Text Search... Done
libpangox-1.0-0/artful 0.0.2-5 amd64
  pango library X backend

libpangox-1.0-dev/artful 0.0.2-5 amd64
  pango library X backend - development files

libpangoxft-1.0-0/artful,now 1.40.12-1 amd64 [installed]
  Layout and rendering of internationalized text

Looks like libpangox-1.0-0 is what we're looking for.

sudo apt install libpangox-1.0-0

And … it works! ./vpnui as well as the "Cisco Anyconnect" starter will let you configure your VPN.

Comments

If you have comments, questions or opinions please drop me a line at blog AT zngguvnf dot org. Please tell me whether it's ok to publish your comment here or not.

Processing multiple PDFs using the command line

<2017-12-01>

Update [2018-04-17 Tue]

Update [2018-03-30 Fri]:

From time to time I need to process lots of .pdf files.

Here are a few commandline calls that help me a lot:

Split pdf in single pages

Split one .pdf with multiple pages in multiple .pdf files with just one page.

pdftk PdfWithMultiplePages.pdf burst
qpdf --split-pages input.pdf output.pdf

Merge pages to single pdf

Merge multiple .pdf with one or more pages into one single .pdf.

To merge all .pdf in currenct directory to one single file:

pdftk ./*.pdf cat output PdfWithMultiplePages.pdf

Alternatively to can type pdftk, mark all files you want to combine in your file manager, drag and drop them to your terminal and finish the command with cat output PDFWithMultiplePages.pdf

pdfjam ./*pdf -o PdfWithMultiplePages.pdf

Convert from DIN A3 (landscape) to DIN A4 portrait

Sometimes .pdf are in DIN A3 (landscape) and it looks like two DIN A4 pages side by side.

Use the following command to split those documents:

mutool poster -y 2 input.pdf output.pdf

(use -y to preform a vertical split or -x for a horizontal split.) mutool comes as part of mupdf (sudo apt install mupdf-tools)

Convert to DIN A4

pdfjam --outfile filename.pdf --paper a4paper filename.pdf

Batch processing

To convert all .pdf files including those in subfolders to a4

for f in ./**/*.pdf ; do
  pdfjam --outfile "$f" --paper a4paper "$f"
done

Reduce file size of scanned PDF file

There is a question for this on stackexchange and a fantastic answer, which I would like to insert here for reference:

Use the following ghostscript command:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
  • -dPDFSETTINGS=/screen lower quality, smaller size.
  • -dPDFSETTINGS=/ebook for better quality, but slightly larger pdfs.
  • -dPDFSETTINGS=/prepress output similar to Acrobat Distiller "Prepress Optimized" setting
  • -dPDFSETTINGS=/printer selects output similar to the Acrobat Distiller "Print Optimized" setting
  • -dPDFSETTINGS=/default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file

Remove password from pdf

qpdf -password=YourTopSecretPassword -decrypt password-protected-file.pdf file-without-password.pdf

Remove string from pdf

(works to remove text that you can mark in the pdf)

qpdf --stream-data=uncompress YourFile.pdf uncompressed.pdf

Replace 'Some Text' with whitespace

sed 's/Some Text/ /g' < uncompressed.pdf > uncompressed_without_string.pdf

If you want to replace things other than letters (such as brackets), the sed manual will help you. Sometimes it is helpful to remove the desired expression in individual steps (but watch out that you only delete it where you want it to be deleted).

qpdf --stream-data=compress uncompressed_without_string.pdf YourFile_free.pdf

Comments

If you have comments, questions or opinions please drop me a line at blog AT zngguvnf dot org. Please tell me whether it's ok to publish your comment here or not.

EuroScipy 2017

<2017-09-06>

Introduction

From 28.08 to 31.08 I was at the EuroScipy in Erlangen. There were about 200, mainly scientists from all over Europe, exchanged experiences they gained while working with Python. The people at the conference were very open and helpful.

The EuroScipy consisted of two days of tutorials and two days of conference.

Tutorials

The tutorials included two different tracks, one for beginners and one for advanced users.

I myself was in the advanced track, which was dominated by topics about big data and machine learning. I would like to recommend the tutorials about Sklearn, Pandas and Sympy.

From many people who were on the beginner track I heard that they just got started with Python. In my view, the conference is the perfect opportunity for this. With talk about Python, NumPy, Matplotlib, Pandas, SciPy and last but not least git you get a very good overview of the largest packages for scientific work with Python and additionally access to a very open and helpful community. Given the licensing costs of similar languages like Matlab, it should be worthwhile for companies to send their employees to 'training courses' like EuroScipy.

Conference talks

The conference talks were about 15 minutes long and full off new and exciting stuff, the lecturer build using Python.

Most of the time it felt like the presented project was a side project of their main research they want to share with the community.

I like this a lot. Lots of research is founded by public resources and I think it is the right way to make the results available to the public again.

A highlight of the EuroScipy 2017 for me was the keynote from Julia Rohrer with the title: 'How to Fix a Scientific Culture: Psychology as a Cautionary Tale and Paragon'.

In her talk Julia criticized that especially in psychological many scientific papers contain wrong evaluations. But due to missing data, analysis scripts and closed access the results are hard to reproduce.

With preregistration and Open Science Framework she named tools that fix this and improve the quality of science. In her lecture, she referred to the field of psychology but in the following discussion it quickly became clear that this is a multidisciplinary problem.

During the EuroScipy, however, I realized that everyone uses git and Jupyter notebooks. These are great tools for reproducible research. So it's time to use these tools not only for open source software and tutorials but also for publishing scientific work.

Social

Besides tutorials and conference talks, the EuroScipy also consisted of a lot of very interesting conversations. It was amazing to talk to with people from completely different areas. Despite the different work fields everyone had similar problems which they resolved with the same Python toolboxes.

A highlight of the discussion for me was certainly a conversation with one of the core NumPy developer. Thank you, Julian!

All in all, I really enjoyed the open community at EuroScipy and I'm going to try to share more of what I do with other people in the future. Hopefully this blog is just the beginning. In the future, significantly more projects will be published on my GitHub account and maybe I'll be able to create a poster or a short talk for the next EuroScipy.

Comments

If you have comments, questions or opinions please drop me a line at 2017-09-06–euroscipy-2017 AT zngguvnf dot org. Please tell me whether it's ok to publish your comment here or not.

Capture TODOs with iOS and orgmode

<2017-08-18>

tl;dr

Introduction

After trying out multiple iOS apps (MobileOrg, Drafts, Rem) to capture TODOs on the road and sync them with emacs orgmode I finally found a solution using Audio Memos.

Audio Memo is an App that runs on Android, iOS and watchOS. I'm using it on iOS and watchOS and it works very good.

Instead of typing my TODOs I now speak them into my Apple Watch. This has multiple advantages:

  • It's much faster
  • You can use it on the bike
  • You can use it to capture your dreams (in case you wear your Apple Watch at night ;) )

Setup

You need:

I have the following in my ~/.emacs.d/init.el

(use-package audio-notes-mode
:config (setq anm/notes-directory "~/share/audio-memos")
        (setq anm/goto-file "~/org/audio-notes.org")
)

Workflow

  • Tap the Audio Memo icon on your iPhone or Apple Watch
    • (Recording starts automatically)
  • speak
  • press pause
  • press save
  • you are done!
  • (when using the Apple Watch you must launch the iOS app to start the sync (starting the app is enough, sync will start automatically))
  • in emacs do M-x audio-notes-mode to listen to your memos

Comments

DISCLAIMER: I AM NOT PAID OR COMPENSATED IN ANY FORM TO PROMOTE THE MENTIONED APPS.

If you have comments, questions or opinions please drop me a line at 2017-08-18–capture-todos-with-ios-and-orgmode AT zngguvnf dot org. Please tell me whether it's ok to publish your comment here or not.

Other posts