Categories
General

postfix: send via smarthost

To be able to send emails from a linux server via a smarthost just add this to your /etc/postfix/main.cf:

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:smtp@example.com:mypassword
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
relayhost = mail.example.com:587

I use this on my home-server/NAS behind a DSL line to get the root-messages (refer https://www.bergercity.de/general/postfix-redirect-mails-for-root/).

Categories
General MacOS

Show FileVault status

Show FileVault encryption status:

#apfs volumes (look/grep for "Encryption Progress")
diskutil apfs list

#hfs
diskutil cs list

Categories
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.

Categories
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
Categories
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).

Categories
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.

Categories
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
Categories
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).

Categories
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
Categories
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