Merge branch 'dev' into vhs
This commit is contained in:
commit
17b90a54cb
9
data/calcurse.md
Normal file
9
data/calcurse.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
title: "calcurse"
|
||||||
|
tags: [ "data", "calendar", "daylight savings" ]
|
||||||
|
---
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
The UK government keeps an ics file with clock, [here](https://www.gov.uk/when-do-the-clocks-change/united-kingdom.ics).
|
||||||
|
|
126
data/radicale.md
Normal file
126
data/radicale.md
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
---
|
||||||
|
title: "radicale and nginx"
|
||||||
|
tags: [ "data", "calendar" ]
|
||||||
|
---
|
||||||
|
|
||||||
|
Check before you start:
|
||||||
|
|
||||||
|
- you have a normally running site on nginx already.
|
||||||
|
- your server has the directory `/etc/nginx/sites-enabled/` enabled in the nginx config.
|
||||||
|
|
||||||
|
## Installation and Service
|
||||||
|
|
||||||
|
Install `radicale` through your package manager (not `pip`).
|
||||||
|
The standard `radicale` package should come with a nice `systemd` service file.
|
||||||
|
|
||||||
|
If the service comes already-started, stop it immediately:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl stop radicale
|
||||||
|
```
|
||||||
|
|
||||||
|
## Set up Passwords
|
||||||
|
|
||||||
|
Edit `/etc/radicale/config`, changing the `[auth]` section from this:
|
||||||
|
|
||||||
|
```
|
||||||
|
#type = none
|
||||||
|
```
|
||||||
|
|
||||||
|
...to this:
|
||||||
|
```
|
||||||
|
#type = htpasswd
|
||||||
|
```
|
||||||
|
|
||||||
|
If the service is started, restart it to make sure nobody can sign in without a password.
|
||||||
|
|
||||||
|
|
||||||
|
Next, find the `htpasswd` program.
|
||||||
|
You might get it in the `apache` package or similar.
|
||||||
|
|
||||||
|
`htpasswd` allows you to generate passwords for users, and place them in `/etc/radicale/users`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
PASS="$(xkcdpass)
|
||||||
|
htpasswd -nb $USER "$PASS" | sudo tee -a /etc/radicale/users
|
||||||
|
echo "Your username is $USER"
|
||||||
|
echo "Your password is $PASS"
|
||||||
|
```
|
||||||
|
Right now, you can't sign into the server except through the localhost, which is pointless.
|
||||||
|
So now we add a subdomain to `nginx`.
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
|
||||||
|
echo '
|
||||||
|
server {
|
||||||
|
if ($host = cal.DOMAIN) {
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
} # managed by Certbot
|
||||||
|
|
||||||
|
|
||||||
|
listen 80;
|
||||||
|
server_name cal.DOMAIN;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://localhost:5232;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 301 https://$server_name$request_uri;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name cal.DOMAIN;
|
||||||
|
ssl_certificate /etc/letsencrypt/live/cal.DOMAIN/fullchain.pem; # managed by Certbot
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/cal.DOMAIN/privkey.pem; # managed by Certbot
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://localhost:5232;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
' > /etc/nginx/sites-available/radicale
|
||||||
|
sudo ln -s /etc/nginx/sites-available/radicale /etc/nginx/sites-enables/
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, replace the example `DOMAIN` with your actual domain name.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DOMAIN=whatever.com
|
||||||
|
sudo sed -i "s/DOMAIN/$DOMAIN/g" /etc/nginx/sites-available/radicale
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
(optional: replace that `cal.` prefix with anything else)
|
||||||
|
|
||||||
|
Check nginx is happy:
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo nginx -t
|
||||||
|
```
|
||||||
|
You will almost certainly need a new SSL certificate for the site:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo certbod -d cal.$DOMAIN
|
||||||
|
```
|
||||||
|
|
||||||
|
Start or restart both services:
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl start radicale
|
||||||
|
sudo systemctl restart nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
You should now be able to log into your calendar, and add it to a phone.
|
||||||
|
|
||||||
|
NB: you don't need the port number.
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: "Terminal Tips"
|
title: "bash tips"
|
||||||
tags: [ "Documentation", "System" ]
|
tags: [ "Documentation", "Shell", "POSIX" ]
|
||||||
---
|
---
|
||||||
## Track Live Changes
|
## Track Live Changes
|
||||||
|
|
||||||
@ -67,6 +67,18 @@ Add number to variables with:
|
|||||||
|
|
||||||
`((n--))` works identically.
|
`((n--))` works identically.
|
||||||
|
|
||||||
|
### POSIX WARNING
|
||||||
|
|
||||||
|
The number commands above work in `bash`, but not in bare-ass POSIX shells, such as `dash`.
|
||||||
|
|
||||||
|
Instead, you might do:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
x=2
|
||||||
|
x=$(( x +1 ))
|
||||||
|
x=$(( x*x ))
|
||||||
|
```
|
||||||
|
|
||||||
## Finding Duplicate Files
|
## Finding Duplicate Files
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -97,3 +109,8 @@ That gives you a random directory to mess about in.
|
|||||||
cd $dir
|
cd $dir
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### POSIX WARNING
|
||||||
|
|
||||||
|
These smart-brackets are a bash feature.
|
||||||
|
If you try to use `{A..Z}` in dash, it will think of this as a single item.
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
title: "imagemagick"
|
title: "imagemagick"
|
||||||
tags: [ "Documentation", "Vision" ]
|
tags: [ "Documentation", "Vision" ]
|
||||||
---
|
---
|
||||||
[Source](http://lxlinux.com/imagemagick.html)
|
|
||||||
|
|
||||||
Convert jpg to png.
|
Convert jpg to png.
|
||||||
|
|
||||||
@ -41,13 +40,13 @@ convert image.jpg -resize 25% output.jpg
|
|||||||
|
|
||||||
# Trim images to border
|
# Trim images to border
|
||||||
|
|
||||||
This is generally used for transparrent images.
|
This is generally used for transparent images.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
convert -trim image.png output.png
|
convert -trim image.png output.png
|
||||||
```
|
```
|
||||||
|
|
||||||
Make the white of an image transparrent.
|
Make the white of an image transparent.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
convert -transparent white -fuzz 10% input.png output.png
|
convert -transparent white -fuzz 10% input.png output.png
|
||||||
@ -101,7 +100,7 @@ See your installed fonts:
|
|||||||
convert -list font
|
convert -list font
|
||||||
```
|
```
|
||||||
|
|
||||||
Make na image showing day of the week:
|
Make an image showing day of the week:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
convert -fill blue -font Sauce-Code-Pro-Semibold-Nerd-Font-Complete-Mono -gravity center -pointsize 79 label:$(date +%A) day.png
|
convert -fill blue -font Sauce-Code-Pro-Semibold-Nerd-Font-Complete-Mono -gravity center -pointsize 79 label:$(date +%A) day.png
|
||||||
|
Loading…
Reference in New Issue
Block a user