Подписаться на блог

Ихрь постит в уютный бложик

Фрирайтинг, заметки, шитпостинг и все подряд (18+)

How to sync Obsidian between iOS devices

I’ve written a lot of notes since 2010, I really like methodologies like second mind and Zettelkasten, and as a consequence I really like Obsidian.

And many times I’ve seen people find solutions to synchronize different iOS/iPad OS devices without iCloud and Obsidian Sync. People use Apple Shortcuts and third-party tools like Working Copy to sync Obsidian via git, or use terminal emulators like iSH to mount the vault directory and sync it manually.

But Obsidian on mobile devices (yes, iOS too) supports community plugins.
And instead of reinventing the wheel, you can... just install the plugin you need.

Just go to Settings — Community Plugins — Browse. And install:

  • «Obsidian Git» for synchronization with git;
  • «Remote Save» to synchronize with S3/WebDav.

Yes, it works on iOS devices, it works natively and automatically on startup, you just need to enable it in the settings. And also you can add shortcut to Obsidian menu to call action you need.
Enjoy!

Fix Apple Pencil 2 iPad connection

Sometimes when you connect Apple Pencil 2 to iPad, the battery level is not displayed, only «Apple Pencil» notification appears and the screen does not recognize the pen.

To fix it:

  • remove the pen from the bluetooth device list;
  • reconnect the pen to the magnetic connector;
  • restart iPad with pencil on magnetic connector.

In some cases it works after 2-3 times.

Be careful. It can indicate about damaged Apple Pencil battery or the pen itself.

How to inline TailwindCSS styles to SSR NextJS

By default, NextJS may not include Tailwind styles in the SSR build, and with disabled JavaScript, your site may look ugly like pure HTML.

To fix this, you need to install the critters package.

npm install critters

And enable optimizeCss rule in next.config.js.

experimental: {
    optimizeCss: true,
},

Source: next.js#12868.

Change SSH port on Ubuntu 22 using Ansible

After updating Ubuntu 22.10 SSHd uses socket-based activation.
As a result, the sshd configuration port does not affect the listening port.
To change the port, we need to perform the following tasks:

- name: Create config folder
  file:
    path: /etc/systemd/system/ssh.socket.d
    state: directory
    recurse: true

- name: Create config file
  copy:
    dest: /etc/systemd/system/ssh.socket.d/listen.conf
    content: |
      [Socket]
      ListenStream={{ custom_ssh_port }}

- name: Reload systemd manager
  systemd:
    daemon_reload: yes

- name: restart ssh
  service:
    name: "ssh"
    state: restarted

- name: Update connection port
  set_fact:
    ansible_ssh_port: "{{ custom_ssh_port }}"

How to fix unknown fragments types in graphql-codegen?

I spent half of the day setting up graphql-codegen to generate the correct types for fragment queries.

At first, my code looked like this:

// file1
export const DIALOG_FIELDS = gql(`
  fragment DialogFields on Dialog {
    id
    name
  }
`);

// file2
export const GET_DIALOG = gql(`
  ${DIALOG_FIELDS}
  query GetDialog($dialogId: ID!) {
    dialog(id: $dialogId) {
      ...DialogFields
    }
  }
`);
const config: CodegenConfig = {
  schema: CONFIG.apiHost,
  documents: ['src/**/*.{tsx,ts,js,jsx}', '!src/gql/__generated__/*.ts'],
  generates: {
    './src/gql/__generated__/': {
      preset: 'client',
      plugins: [],
      overwrite: true,
      presetConfig: {
        gqlTagName: 'gql'
      }
    }
  },
};

So, with the basic config I did get an unknown type for both the query and the fragment:

I found a simple solution for this — we need to remove the string interpolation for the fragment literal from the query, because graphql-codegen automatically includes fragments.

export const GET_DIALOG = gql(`
  query GetDialog($dialogId: ID!) {
    dialog(id: $dialogId) {
      ...DialogFields
    }
  }
`);

As a result, I did get an not unknown type, but the type with no data from the fragment for the query fragment.

I lost the most time at this stage, eventually finding a solution in the small GitHub thread. We need to disable fragment masking feature.

const config: CodegenConfig = {
  schema: CONFIG.apiHost,
  documents: ['src/**/*.{tsx,ts,js,jsx}', '!src/gql/__generated__/*.ts'],
  generates: {
    './src/gql/__generated__/': {
      preset: 'client',
      plugins: [],
      overwrite: true,
      presetConfig: {
        gqlTagName: 'gql',
        fragmentMasking: false
      }
    }
  },
};

Finally the type contains all the information and it is complete!

How to fix broken Outline VPN after installing Charles on Mac OS

Sometimes, after installing Charles or any other web proxy on your Mac OS, Outline VPN or any other 3rd party client on your Mac OS can break your VPN connection. To fix it you need to:

  1. Remove the web proxy configuration from the «Details» tab of your Wi-Fi network configuration.
  2. Remove the web-proxy configuration from the VPN connection configuration.
  3. If you don’t have VPN connection settings and are using a 3rd party client (e. g. Outline VPN), you will need to remove the VPN connection from the VPN tab in System Preferences (not in your client) and reconnect using the 3rd party client.
  4. In this case the connection will be recreated in System Preferences without proxy settings.

Alternatively, you can manually remove the proxy server configuration from

/Library/Preferences/com.apple.networkextension.plist

using any plist editor (e. g. BBEdit) and restart your OS.

Про дебаг в старых Safari

Знаете, что самое веселое в фронтенд-разработке после похорон IE?
Дебажить приложения под Safari старых версий — это просто нереально...

Как я делал с IE? Качал виртуалку с сайта MS с нужной версией IE и спокойно дебажил.

Как я делаю с Safari? Ищу образ виртуалки, их же официально никто не распространяет, а ушлые ребята распространяют образы только через Patreon, WTF?

На ноут я не могу поставить виртуалку со старой Mac OS, потому что у меня ARM процессор. На ПК я не могу поставить потому, что у меня там процессор AMD, а почему-то на новых AMD виртуалки как-то криво инструкции транслируют.

В итоге приходится искать макбуки на Intel, на них ставить виртуалку со старой ОС и там дебажить — во житуха!

Изначально писал в телеге — тык

Ранее Ctrl + ↓