Friedrich Ewald My Personal Website

Recent Posts


  • Git Tips (1)

    Switch to a remote branch locally with

    git switch <branch>
    
    Accidentally committed something to main locally? This can be undone / reset with
    git reset HEAD~1
    

  • Managing mulitple SSH identities for Git

    There are multiple steps required to be able to push/pull from Git repositories with different identities when using SSH Keys.

    1. Set up different host names in ~/.ssh/config, similar to this example:
    Host github-identity1.com
    	HostName github.com
    	User git
    	IdentityFile ~/.ssh/identity1
    
    Host github-identity2.com
    	HostName github.com
    	User git
    	IdentityFile ~/.ssh/identity2
    
    When cloning the repository make sure to use the correct host name, correspdonding to the identity, for example git clone github-identity1.com:user/repo.git. This might sometimes not be enough when pushing to a remote repository. The reason for this is that multiple identities are added to the ssh-agent. To obtain the list of added identities, execute ssh-add -l which returns a list of identities. Those identities will be tried out in order when attempting to push to a remote repository. If the first one fails, the second one will not be tried, instead the whole push fails. To fix this, I had to delete all identities via ssh-add -D and then re-add them one by one via ssh-add path/to/private_key.

  • Installing and building eventmachine

    Installing eventmachine on a new or updated Mac OS can have some challenges. I recently had to reinstall Jekyll after upgrading my personal computer with the latest Mac OS Sequoia. Running bundle install failed with the following error message:

    An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
    
    In Gemfile:
      jekyll-compose was resolved to 0.12.0, which depends on
        jekyll was resolved to 4.3.3, which depends on
          em-websocket was resolved to 0.5.3, which depends on
            eventmachine
    
    The root cause in my case was a broken installation of Ruby due to the XCode Command Line Tools being broken after the upgrade.

    Continue reading

  • Traveling with a Mac Book

    I recently returned from a trip to Europe (GMT+2) to the West Coast (PT). Upon returning I noticed that none of my Two-factor (MFA) codes were accepted by either Cloudflare or AWS. I had not restarted my MacBook since leaving Europe. It seems to me that the internal clock which is used to calculate the current MFA code is not reset when switching time zones, thus producing invalid codes. A restart of the computer fixed this issue. Update: I also noticed that this happens sometimes when the laptop is closed (asleep) for some period of time. I found this little command that synchronizes the time.

    sudo sntp -sS time.apple.com

  • Leetcode: Binary Search Matrix

    Continue reading

Previous Page: 1 of 33