-
Notifications
You must be signed in to change notification settings - Fork 0
/
entries.yml
150 lines (125 loc) · 8.81 KB
/
entries.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
categories: [] # This variable gets populated when the playbook runs | Note [] tells Ansible this var should hold a list
entries:
- title: Pin a file or folder to the dock in MacOS
date: "2024.10.23"
category: macos
content: |
When attempting to drag a file or folder straight from finder into the dock, you might be suprised to discover that this does not work. Quite strange when you consider most actions in macOS are very much drag-drop oriented.
> [!TIP]
> Pressing `control` + `shift` + `⌘` + `T` is the keyboard shortcut for "Add to Dock" when a file or folder is highlighted in Finder!
However, not being able to simply drag a file into the dock doesn't mean it is impossible. Here's how to do it:
1. Within finder navigate to the file or you'd like to pin to the dock.
2. In the global menu click on the `File` menu option while holding down the `shift` key on the keyboard.
3. Click the *Add to Dock* option and the file or folder will now be pinned to the dock!
sources:
- text: "How to Pin a Folder or a File to Your Mac's Dock"
link: "https://www.howtogeek.com/712237/how-to-pin-a-folder-or-a-file-to-your-macs-dock/"
tags: apple, macos, dock, finder
# - END OF POST
- title: Using the present working directory as a value for your environment variables
date: "2024.10.10"
category: linux
content: |
I use a [custom git-cliff configuration](https://github.com/bvdbasch/dotfiles/blob/master/roles/git/templates/cliff.toml.j2) for generating changelogs. The changelog it produces is fantastic, but unfortunately - by default - git-cliff does *not* export the generated changelog to a file.
There is an environment variable you can set called `GIT_CLIFF_OUTPUT` which will instruct git-cliff to always store the generated changelog in that location. Great, but what about multiple projects in multiple locations?
Well, I realized that when you're asking git-cliff to generate a changelog you are most likely already in the project folder, so using the current directory as the value for the output location would work. We know the `pwd` command (present working directory) produces the exact output we need, but simply putting this into an the environment variable **will not work**.
To be very clear: `GIT_CLIFF_OUTPUT="pwd/CHANGELOG.md"` will not do anything, because pwd gets treated as text and not as a command. So how do we make sure that it does get treated as a command? Simple: just wrap it in parenthesis and prepend it with a dollar sign `$(pwd)` :D
So the final solution is: `GIT_CLIFF_OUTPUT="$(pwd)/CHANGELOG.md"`, which will create the changelog in the current directory. Perfect.
sources:
- text: "This saves the absolute path of the current working directory to the variable cwd"
link: "https://stackoverflow.com/a/13275062"
tags: devops, shell, scripting, zsh, git, git-cliff
# - END OF POST
- title: Viewing the status of a specific service
date: "2024.07.30"
category: linux
content: |
I had to verify that a service on a remote server was still working as intended afer applying a configuration change. Luckily checking this is a breeze, because when you know the name of a service you can see how it is doing with the following command:
```sh
systemctl status <service_name_here>
```
As an example: running `systemctl status lighttpd.service` will yield:
```sh
● lighttpd.service - Lighttpd Daemon
Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-08-04 04:29:19 UTC; 3 weeks 2 days ago
Main PID: 105 (lighttpd)
Tasks: 1 (limit: 115783)
Memory: 56.5M
CGroup: /system.slice/lighttpd.service
└─105 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
Aug 04 04:29:19 utls-bash-wiki systemd[1]: Starting Lighttpd Daemon...
Aug 04 04:29:19 utls-bash-wiki systemd[1]: Started Lighttpd Daemon.
```
sources:
- text: "How to view status of a service on Linux using systemctl"
link: "https://www.cyberciti.biz/faq/systemd-systemctl-view-status-of-a-service-on-linux/"
tags: devops, shell, sudo, services, logging, unix
# - END OF POST
- title: Change the default folder when saving screenshots on MacOS
date: "2024.07.02"
category: macos
content: |
By default MacOS saves all screenshots to your desktop. This may be fine for some, but for me it is far from ideal. I'd rather have th e screenshots saved to a dedicated screenshots folder. The commands below achieve that.
```zsh
$ defaults write com.apple.screencapture location <new_folder_location>
$ killall SystemUIServer
```
The first command `defaults write ...` sets the new default location
The second command `killall` kills the lingering processes, making sure that the new location takes effect the next time you take a screenshot.
## Bonus
I keep forgetting that the screenshot utility has some nifty keyboard shortcuts, so I've jotted the ones I'm interested in here:
1. When you take a screenshot with `cmd + shift + 4` you can press `space`` to toggle between region and full window for your current screenshot
2. Use `cmd + shift + 3` to take a screenshot of the whole flippin' screen
sources:
- text: "MacOS screenshot utility keyboard shortcuts"
link: "https://support.apple.com/guide/mac-help/take-a-screenshot-mh26782/mac"
- text: "How to change the default screenshot save location"
link: "http://osxdaily.com/2011/01/26/change-the-screenshot-save-file-location-in-mac-os-x/"
tags: apple, macos, screenshots, plist
# - END OF POST
- title: Make TextEdit.app on MacOS behave more like Windows Notepad (notepad.exe)
date: "2024.04.05"
category: macos
content: |
Say what you will about Windows, but Notepad.exe is a great tool. It just treats text as plain text. When first switching to macOS you come to find that Notepad.exe is TextEdit.app, but the problem is that well... It doesn't do plain text out of the box. Instead it does rich text formatting. Fortunately Apple gave us the ability to set plain text as the default. Hurray!
Here's how to do it:
1. Open settings (`⌘` + `,`)
2. On the `New Document` tab in the settings window select the option `Plain text`
Going forward any new document you create in TextEdit will automatically be in plain text and will be saved as a .txt file. YES!
sources:
- text: "How to use .txt Plain Text by default in TextEdit"
link: "https://www.idownloadblog.com/2016/12/26/how-to-use-plain-text-by-default-in-textedit/"
tags: apple, macos, notepad, notepad++, textedit, plain-text
# - END OF POST
- title: Install any zsh plugin with antigen directly from a github repository
date: "2024.01.24"
category: shell
content: |
Sometimes a shell plugin has instructions on how to install itself with antigen. For example [popstas/zsh-command-time](https://github.com/popstas/zsh-command-time) has the following instructions [in their README](https://github.com/popstas/zsh-command-time?tab=readme-ov-file#install-with-antigen):
> ```Markdown
> # Install with antigen
> `antigen bundle popstas/zsh-command-time`
> ```
The above is a fairly common way of adding a plugin to your shell. But what do you do when you stumble upon a repository of a plugin that does not have this? Like the [tom-auger/cmdtime repository](https://github.com/tom-auger/cmdtime). When you try: `antigen bundle tom-auger/cmdtime` you'll see the following error `Installing tom-auger/cmdtime... Error! Activate logging and try again.` staring right at you!
What then is the solution? A quite straightforward actually:
1. Locate the antigen plugin directory on your harddrive
2. Clone the repository directly in that directory
3. Reload your shell and voila! Now you can use the plugin
tags: shell, unix, zsh, plugins, antigen
# - END OF POST
- title: Setting up a new Python virtual environment with Poetry and PyEnv
date: "2024.01.11"
category: python
content: |
Today I had to set up a small python project from scratch rather than continuing from a pre-existing project. Since I've only had to deal with projects already containing a `pyproject.toml` this was a new experience for me. Here's how I did it
## Create the environment, add the dependencies and jump into the shell
> [!NOTE]
> Prerequisites: [PyEnv](https://github.com/pyenv/pyenv) and [Poetry](https://github.com/python-poetry/poetry)
```sh
$ cd <target_dir>
$ poetry init # follow on the on screen instructions
$ poetry shell # spawn environment shell
```
tags: python, poetry, dependency-management, pyenv, venv