Skip to content

Instantly share code, notes, and snippets.

View bulletinmybeard's full-sized avatar
🤘

Robin Schulz bulletinmybeard

🤘
View GitHub Profile
@bulletinmybeard
bulletinmybeard / debug-python-apps-via-docker-composeyml-in-pycharm.md
Last active March 30, 2024 10:26
Debug Python apps via "docker-compose.yml" in PyCharm

If you containerize your Python application using docker-compose.yml, you can easily run and debug the application in PyCharm. Before starting, ensure that no related Docker containers or Python apps are running and occupying the (exposed) ports.

  • Open PyCharm
  • Go to: Add New Interpreter
  • Pick: On Docker Compose
  • Pick Server: Docker
  • Pick Configuration files: ./docker-compose.yml
  • Pick Service: name of the service you want to start and debug
  • Set Environment Variables: add some env vars if desired and not covered by the docker-compose.yml or Dockerfile and click next
@bulletinmybeard
bulletinmybeard / local-nginx-server-site-with-valid-ssl-certificate.md
Last active March 8, 2024 21:34
Local NGINX server site with valid SSL certificate

1.) Create a new mapping entry in your /etc/hosts:

127.0.0.1 app.local

2.) Create a suitable and trustworthy SSL certificate with mkcert (https://github.com/FiloSottile/mkcert) in something like /opt/homebrew/etc/nginx/ssl/certs/...

mkcert app.local "*.app.local"
@bulletinmybeard
bulletinmybeard / python-script-to-alter-file-creation-date-from-filename.md
Created May 21, 2023 21:03
Python Script to alter file creation date from filename (e.g., 02_05_2023_test_recording.m4a)
import os
import re
import datetime

directory = "./"
date_pattern = r"(\d{2}_\d{2}_\d{4})"

for filename in os.listdir(directory):
 if filename.endswith(".m4a"):
@bulletinmybeard
bulletinmybeard / macos-prevent-flux-from-automatically-toggling-light-and-dark-mode.md
Last active April 11, 2023 05:20
MacOS - Prevent f.lux from automatically toggling light and dark mode

If your macOS dark OS appearance automatically changes back to light mode after installing and starting f.lux, you may be using the color effect called MacOS Dark theme Dark theme at sunset, which toggles light/dark mode.

f.lux screenshot

Personally, I don't use those color effects, but I have heard that other effects will not toggle the dark/light mode automatically.

Tested

@bulletinmybeard
bulletinmybeard / change-default-login-shell-on-macos-ventura.md
Last active April 10, 2023 14:22
Change Default Login Shell On MacOS (>=Ventura)

In some cases, the default zsh shell isn't desired or working. Switching temporary or permanent is easily doable. At first, check the currently active shell, list all available shells, and ultimately change the default shell.

Display the path of the currently active shell

~ echo $SHELL
/bin/zsh

List all acceptable shells

@bulletinmybeard
bulletinmybeard / customize-default-syntax-highlighter-in-atom-editor-macos--linux.md
Last active April 10, 2023 09:55
Customize default syntax highlighter in Atom editor (macOS + Linux)

If you're using the Atom editor for taking notes, consider setting the default language grammar to Markdown instead of Plain Text. To do this, navigate to the ~/.atom directory, open the CoffeeScript init.coffee (~/.atom/init.coffee) and append the following code snippet to it:

# source.gfm => GitHub Flavored Markdown
atom.workspace.observeTextEditors (editor) ->
 if !editor.getPath()
@bulletinmybeard
bulletinmybeard / list-installed-homebrew-packages-in-tree-view-macos.md
Created April 9, 2023 07:20
List installed homebrew packages in tree viewList installed homebrew packages in tree view (macOS)

List installed homebrew packages in tree view:

Simple

➜  brew list --formulae | sed 's/^/├── /' | sed '1s/├/└/' | sed '$s/$/\n/'
└── age
├── aom
├── aribb24
├── autoconf
├── automake
@bulletinmybeard
bulletinmybeard / delete-all-node_modules-folders-recursively.md
Last active July 8, 2024 03:47
Delete all `node_modules` folders recursively (Linux / macOS / Windows)

macOS

# Search in the Spotlight index
# https://developer.apple.com/library/archive/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/Introduction.html
mdfind "kMDItemFSName=node_modules && kMDItemContentType=public.folder" | xargs rm -rf

# Simple, fast and user-friendly alternative to find (brew install fd)
# https://github.com/sharkdp/fd
fd -t d -H -E node_modules | xargs rm -rf
@bulletinmybeard
bulletinmybeard / resolve-tabnine-subscription-sync-issues-in-your-ide.md
Last active June 5, 2023 06:08
Resolve tabnine subscription sync issues in your IDE

My Tabnine Pro subscription expired the other day, and renewing didn’t work because of UI-related issues in multiple different browsers. The UI issues forced me to create a new Tabnine account and to subscribe with that one. However, my JetBrains IDEs, such as PHPStorm, PyCharm, and IntelliJ, started showing a warning next to the tabninPro IDE plugin info and the Pro features stopped showing up.

It seemed that the JetBrains Plugin kept using the stored login credentials from the previous account with no subscription in place. Unfortunately, simply visiting the tabnine website from within my IDE via Open Tabnine Hub didn’t help to enforce the IDE plugin using my new credentials.

What helped was to delete the IDE, its internal browser cache and cookies that are being used by tabnine.

To do so, go to the following URLs and make sure you’re logged out:

@bulletinmybeard
bulletinmybeard / using-prompt-eol-mark-to-remove-extra-trailing-mark-in-terminal-output.md
Last active April 2, 2023 14:33
Using `PROMPT_EOL_MARK` to remove extra trailing mark in Terminal Output (macOS+Linux)

If you encounter an extra percent mark at the end of the command output (e.g., %), it's likely caused by the PROMPT_EOL_MARK. To fix this issue, you can either export the following environment variables for the current shell session or add them to your bash or zsh configuration file to make the changes permanent.

export PROMPT_CR
export PROMPT_SP
export PROMPT_EOL_MARK=''