Kategorien
General MacOS

MacOS Java 13 installation

Using homebrew finding and installing the right java runtime is an easy task:

brew cask install java

Yes, sometimes I still need java on my desktop, like for designing load tests using JMeter.

Kategorien
DevOps General

Ansible Galaxy dependency usage

Short note on ansible/ansible galaxy:

  • ansible-galaxy takes care of install the roles. Regardless if defined via a requirements.yaml or defined via the „dependencies:“ section in the meta/main.yaml of a role.
  • ansible-playbook/ansible-pull doesn’t care about installation of roles, it just wants the defined dependencies (same meta/main.yaml) to be present. Here is the role_path important.

Knowing this it allows you to fulfill many usage- and development patterns. Like developing company wide reusable ansible roles with multiple teams (DevOps).

Example:

Shared roles using gitlab repositories

Define the role dependencies in the corresponding section of the role’s meta/main.yml.

dependencies:
  
  - src: https://gitlab%2Bdeploy-token-13:xxx@gitlab.example.com/ansible/shared/nginx.git
    scm: git
    version: master
    name: nginx

  - src: https://gitlab%2Bdeploy-token-13:xxx@gitlab.example.com/ansible/shared/postfix.git
    scm: git
    version: master
    name: postfix

Usage

The installation of roles (and their dependencies) and running the playbook becomes a simple two-liner:

# install roles and their dependencies
ansible-galaxy install "git+https://gitlab+deploy-token-19:xxx@gitlab.example.com/ansible/products/product.git,master" --force

# apply the playbook (using the defined and installed dependencies)
ansible-playbook -i localhost, /root/.ansible/roles/product/product/playbook.yml
Kategorien
General MacOS

MacOS Catalina and Fujitsu ScanSnap S300

The quite old, but still perfectly working ADF scanner ScanSnap S300 is not supported anymore by Fujitsu. With MacOS Mojave the scanner worked very well using the ScanSnap S1300i driver. But not so with Catalina – the new ScanSnap Home software checks the connected Device IDs.

Only solution: Fujitsu wants me to buy a new Scanner although the current one is still working fine (hardware wise)…

I could not find a simple solution. Yes, there are some solutions live VueScan or ExactScan, but for me they feel too expensive.

In the end I’m using now my existing Parallels Windows 10 virtual machine to scan. On that platform the ScanSnap Manager Software is still supported – also in a 64bit version (why not on Mac Fujitsu?). You can use the newer Version from the S1500 (Download)!

Finally I am able to scan again. Without spending valuable resources into a new scanner (just because of a missing switch in a software).

Kategorien
General MacOS

MacOS keychain with AWS CodeCommit

Using temporary credentials (access-tokens) with AWS CodeCommit and git clients can be hard with MacOS. The Keychain saves those credentials and after ~15min you must renew them (remove them manually from the keychain). And if you have also to work with repositories other than AWS (like GitHub, GitLab) its even worse. But since recent git versions (>2.9) it is possible to reset the credential helper by Git-Host!

Using the git credential-helper for CodeCommit repositories only:

[credential "https://git-codecommit.eu-central-1.amazonaws.com"]
  helper=
  helper=!aws codecommit --profile developer-cloudformation credential-helper $@
        UseHttpPath = true

It’s important to add that „helper=“ line. Regularly the global git config contains a „helper=osxkeychain“ line and those helper-directives are additive – but the „helper=“ line breaks/resets that inheritance.

Kategorien
Allgemein MacOS Programmierung

MacOS Photos and AppleScript

Just about to move from Adobe Lightroom (CC) to native Apple Photo App/iCloud (but thats another story).

Unfortunately most of the old AVI videos got a wrong date during the import (not the file-creation date but the date of import). Not helpful. Fortunately Lightroom had set the date/time into the filename, so I should be able to set it from there.

In the end I spent my first night with with AppleScript – thats the outcome:

tell application "Photos"
  activate
  set imageSel to (get selection)
  if imageSel is {} then
    error "Please select some images."
  else
    repeat with im in imageSel
      tell im
        set imageFilename to filename of im as string
        set d to current date

        -- filename format: 20030316_160816_03498.avi
        set the year of d to text 1 thru 4 of imageFilename
        set the month of d to text 5 thru 6 of imageFilename
        set the day of d to text 7 thru 8 of imageFilename
        set the hours of d to text 10 thru 11 of imageFilename
        set the minutes of d to text 12 thru 13 of imageFilename
        set the seconds of d to text 14 thru 15 of imageFilename

        set the date of im to d
      end tell
    end repeat
  end if
end tell
return input
Kategorien
Allgemein

Jetbrains search&replace with regex backreferences

Note for me: Documentation.

Search:

\"date" => "(.*)\.(.*)\.(.*)"

Replace:

\"date" => "20$3-$2-$1"

The example replaces an old-fashioned German date string (24.02.2014) into ISO format (2014-02-24).

Kategorien
Linux

ls -la file listing with date and time

to display always date and time at file listings (also for files that are older):

ls -la --time-style=long-iso
Kategorien
Allgemein MacOS

MacOS Mojave font rendering

MacOS Mojave made my fonts look terrible when using the non-retina, old fashioned „Apple Thunderbold Display“. However Ahmad Awais fixed the issue for me:

defaults write -g CGFontRenderingFontSmoothingDisabled -bool FALSE
Kategorien
General

Cloud storage cost calculation (backup/restore)

Related to my offsite-backup with restic project I recently wanted to choose an cloud-provider as backup target. But that seems not an easy decision. Besides the costs for storage and traffic things getting complicated when it comes to restore: Pricing differs here from $10 to $1300 for a single restore of 500GB!

Although I use mainly AWS for my business projects I consider to use google cloud storage for my private backup. Main reason for me is that the restore options for AWS S3 Glacier are not easy to predict and the costs could be very different.

Kategorien
General

Cloud backup with restic

Yes, I’ve tried multiple approaches in the past to get an offsite-backup up and running. I’ve used rsync first and then obnam and duplicity with encryption. Both successful with remote ssh-hosts.

But times are changing and I wanted to use a cloud-storage provider now instead of a dedicated remote host for my backups – so I started with duplicity/duply to get AWS S3 access running – that worked quite good.

But for some reason I discovered restic on github and gave it a try (maybe because of this introduction)

Things I like:

  • growing user base on GitHub
  • its encrypted (very interesting read on this)
  • uses deduplication
  • usage is straightforward, no hard to read config-files with dozens of options
  • no full-/incremental backups, every backup is a „snapshot“
  • they’re promise to not change the repository format in the future
  • access to cloud providers (tested AWS S3 and Google Cloud Storage) went very easy
  • its using a local cache to speed up (but is not sticked to that)
  • you could move the backups to different locations using standard tools and they’re still usable
  • local backups (like on USB-drives) could be achieved the same way: every destination is considered as „remote“ and is encrypted

Documentation is good, so I won’t share usage details here. But I’ve started backups to Google Cloud Storage last week and it feels great…