Longpress on macOS

By pure coincidence I manage to find a to me previously unknown function in macOS 10.14. For some characters you can actually “longpress” (holding down the key on your keyboard a little while longer than usual) and just like on your cellphone get a little popup bubble with special characters and other related special symbols and whatnot related to the key you are pressing.

The effect of some “longpresses”

This is system wide and a really smooth way of inserting special characters which are not on your keyboard. I am a bit surprised that this has not been marketed better since today is the first time I’ve ever seen this feature or even heard about it.

Graphical editing

To continue along the lines of images and media, i often need to work with images, photographs and graphics for teaching or publication purposes. For work I do have the option of getting access to Photoshop which has been the standard and go-to for editing and dealing with graphical material and Adobe has also developed their product line to contain software optimized for a number of other tasks than just photo editing throughout the years. However, this might not be a given alternative for the average home user and enthusiasm since it does costs a bit. The monetary factor did send me out on a chase for better and cheaper alternatives a few years ago.

Continue reading “Graphical editing”

Firefox Send

I was under the impression that this was something that most people would have found out about by know since it is free, secure and so incredibly useful. Despite this it seems that very few people have found out about this service that I have now been using for over a year.

Sometimes you need to send files, big files which you do not want to upload to some sort of cloud storage, create a shared link and then send this link to someone else to later remember to delete this file again. There is a better way, go to send.firefox.com, upload your file by drag-n-drop or choosing your file and upload. Choose of you want to password protect the file, how many downloads are allowed and/or how many days this file should be available on the server before it is removed, regardless of downloads.

Yes, there is no guarantee that these files are actually removed after having been download or when the deadline is passed though generally I have relatively high confidence in Firefox as a company and I do trust this service, otherwise I would not recommend it.

Go check it out!

Självklart är det ingen som kan säga att dessa filer faktiskt tas bort efter att de har laddats ned eller när den deadline man satt passerats men generellt sett har jag relativt högt förtroende för Firefox och litar även på denna service.

Install AmberTools18 (amber18) on Mac OS X 10.14 (Mojave) using Homebrew (or not)

So after a fair bit of contemplating I made the decision to switch from MacPorts to Homebrew. This has not been a painless process and even if I like Homebrew, there are a number of caveats and I cannot for the life of me understand the motivation for implementing this “features”. Having this said, I am now fully committed to Homebrew and hence instructions for how to compile software will from now on out use Homebrew (or not).

With the recent update from OS X 13.X High Sierra to OS X 14.X Mojave a lot of things broke, as anticipated. This is something that I have now sadly come to expect from any update of the macOS. This did of course include the ability to compile amber on macOS. It turns out that, among other things, Apple decided that ”libstdc++” is deprecated and you should now use ”libc++” without leaving any backwards compatibility solution. Some other important files have also gone missing that used to reside in /usr/include/ that you now need to manually installed from an PKG installer buried in Xcode, this will however stop working with the next major Xcode release and undoubtedly brake a lot of other things as well. Long story short, this is what you need to do to compile AmberTools18/amber18 on macOS Mojave using Homebrew GCC8 or just using the macOS clang compiler. The journey resulting in this post is long and includes more issues than reported though I will not describe all of them since that would take a looooong time and would potentially not be very interesting for the general public.

Compile AmberTools18/amber18 using Homebrew GCC8

  1. Install Xcode and Command Line Tools
    Xcode10 is most appropriately installed from the AppStore
    You need to install Command Line Tools manually by executing the following in Terminal.app
    sudo xcode-select --install

  2. Install Homebrew and GCC
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    brew install gcc

  3. Install missing header files
    In Terminal.app, run the following command to open the PKG installer and follow the instructions.
    open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

  4. Download the AmberTools18/amber18 archives and extract them where you want to install them.
    tar xvf AmberTools18.tar.bz2

  5. Configure and install
    export AMBERHOME=/[PATH]/[TO]/amber18
    export PATH=${AMBERHOME}:$PATH
    Eliminates an error: "cannot find <include> file".
    ln -s /usr/local/bin/gcc-8 /usr/local/bin/gcc
    ln -s /usr/local/bin/g++-8 /usr/local/bin/g++
    ln -s /usr/local/bin/c++-8 /usr/local/bin/c++
    ./configure -macAccelerate gnu
    make install

This will produce a working version of AmberTools18/amber18 using Homebrew GCC8 though there are still issues and there will undoubtedly be more issues that will surface before everything works as intended.

Compile AmberTools18/amber18 using macOS clang

  1. Install Xcode and Command Line Tools
    Xcode10 is most appropriately installed from the AppStore
    You need to install Command Line Tools manually by executing the following in Terminal.app
    sudo xcode-select --install

  2. Install the missing header files
    In Terminal.app, execute the following command to launch the PKG installer and follow the instructions.
    open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

  3. Download AmberTools18/amber18 archives and extract where you want to install.
    tar xvf AmberTools18.tar.bz2

  4. Configure and install
    export AMBERHOME=/[PATH]/[TO]/amber18
    export PATH=${AMBERHOME}:$PATH
    Eliminates an error: "cannot find <include> file".
    vi $AMBERHOME/AmberTools/src/configure2
    Comment out rows 2237-2241
    # if [ "$intelmpi" = 'yes' ]; then
    # echo "Intel MPI must be used with the Intel compilers."
    # exit 1
    # fi

    vi $AMBERHOME/AmberTools/src/pytraj/setup.py
    Change libstdc++ to libc++ on row 142
    142 extra_compile_args.append('-stdlib=libstdc++’)
    142 extra_compile_args.append('-stdlib=libc++’)

    Also change the same on rows 2289-2293
    2289 # mac/clang
    2290 if [ "$skippython" = "no" ]; then
    2291 cpptrajcxxflags="-stdlib=libstdc++ $cpptrajcxxflags"
    2292 cpptrajldflags="-stdlib=libstdc++ -L/usr/lib/"
    2293 fi
    2289 # mac/clang
    2290 if [ "$skippython" = "no" ]; then
    2291 cpptrajcxxflags="-stdlib=libc++ $cpptrajcxxflags"
    2292 cpptrajldflags="-stdlib=libc++ -L/usr/lib/"
    2293 fi

    ./configure -macAccelerate clang
    make install

This produces a working version of AmberTools18/amber18 using macOS clang though there are still issues and there will, without a doubt, be more issues that will surface.

CTFR – Subdomains for HTTPS websites

I recently found this interesting little script that allow you to enumerate available subdomains for any HTTPS website in just a few seconds.

What makes this script extra nice is that it does not make use of “wordlists” or “brute force” to identify available domains though instead abuses certificate transparency logs.

This script was made available by UnaPibaGeek through Github.

Remember not to abuse this tools, only scan domains/websites that you own or have the owners permission to investigate to avoid potential legal issues or upset emotions.

Installing AmberTools17 (amber16) on Mac OS X 10.13.3 using MacPorts

This will be a quick and unpolished walkthrough of how you get a version of AmberTools17 and in the same manner Amber16 (if you have a licence) installed using the package manager MacPorts. I will supply a walkthrough using Homebrew at a later point in time and try to polish this post up to a more thorough appealing guide, maybe including pictures.

I switched computer at work a little while ago just running on routine I installed MacPorts as the package manager and started to fill the blanks. During this process though, I kept coming back to the fact that I found a lot of information comparing MacPorts and Homebrew where there is either a small amount of “true believers” or a growing majority of users that recommends Homebrew over MacPorts for various resons. I will not get into the details here though I will make an effort of presenting the details regarding my experience of switching package manager.

As stated in the heading, I am using a relatively new Mac running 10.13.3 at work, though the process should be the same for most OS X versions. I have semi-confirmed this by repeating the process on a 2009 year model MacBook Pro running 10.11 as well.

You have to be an administrator/have administrative rights on the computer you are attempting to install amber on, regardless of which method you choose later on since both MacPorts and Homebrew both requires an administrator password at some point during the installation process.

To install using MacPorts, do the following

  1. Install Xcode from AppStore
  2. Open a new terminal session (cmd+space, write and search for terminal and open the Terminal.app) and run the following commands to install additional components and approve the license agreement.
    xcode-select --install
    xcodebuild -license
  3. Launch Xcode and install any updates
  4. Go to MacPorts hemsida, download and install according to instructions
  5. Go to XQuartz hemsida in order to download and install XQuartz (the replacement for Apples X11 that is no longer available)
  6. Start a new terminal session
  7. Run the following commands
    sudo port selfupdate
    sudo port upgrade outdated
    sudo port install gcc6
    sudo port install mpich-gcc6
    sudo port select --set gcc mp-gcc6
    sudo port select --set mpi mpich-gcc6-fortran
  8. Register and download AmberTools/Amber from the download site
  9. You’ll receive a file/archive with a name similar to AmberToolsXX.tar.bz2, find this in Finder (likely in your downloads folder), don’t forget to replace XX to the numbers your file actually has. Place this file/archive in a folder where you have read/write permission and where you want to install the package. I will create a folder in my “Home” folder that is called “Software” where I will install AmberTools so this is where I’ll place my downloaded archive file. You can do this in finder using your keyboard and mouse or in the Terminal.app running commands similar to this:
    mkdir ~/Software/
    mv ~/Downloads/AmberToolsXX.tar.bz2 ~/Software/
    cd ~/Software/
  10. If you know how to use the terminal, just “cd” into the directory with the archive file, alternatively if you used the keyboard and mouse/trackpad combo, open a new terminal session, type “cd ” at the $ prompt, don’t forget to ad a trailing space and then “drag-and-drop” the folder icon containing the archive in “Finder”, drag it to the Terminal window and drop it there. This should print out the path to that folder so then just press “enter”/”return” on your keyboard.
  11. When placed in the correct directory in the terminal, run this command
    tar xvf AmberToolsXX.tar.bz2
    to extract the archive.
  12. Then run this command
    export AMBERHOME=~/Software/amberXX/
    (again, replace XX to the correct numbers)
  13. Then run this command to place yourself in the correct subdirectory
  14. and run this command
    ./configure -macAccelerate gnu
    Then compile the serial version first
    make install
  15. Once this process has finished, you’ll be presented with some info and be prompted to perform some actions. This can be performed as following, open a new terminal window (do not close the install terminal yet!) and do the following
    vi ~/.profile
    Press “i” on your keyboard to activate “edit” mode, in the “install terminal” highlight and copy the line reading something similar to below and paste this in the “.profile” terminal in a new line
    test -f ~/Software/amberXX//amber.sh && source ~/Software/amberXX//amber.sh
    Press the “esc” key, hold down “shift” and press the “z” key twice (shift+z+z) to save and exit the editor. In both terminals, type
  16. Close both terminal windows, quit out of Terminal.app and then start a brand new terminal session. Then runt the following
    make test
  17. If the tests looks OK you now have a working serial installation of Amber/AmberTools. What remains is the parallell version, if inclined then run the following
    ./configure -macAccelerate -mpi gnu
    make install
    export DO_PARALLEL='mpirun -np 2'
    make test.parallel
    export DO-PARALLEL='mpirun -np 4'
    make test.parallel
  18. If the tests work and no large issues are encountered the complete installation is now finished.

This post looks kind of awful, I’ll try to work in some CSS modifications at some point in time.