Compare commits
No commits in common. "786178195b7a0e072df82069fea01e2704b8ec84" and "a6907d7a911453c14bf26ac41e72225fe40444f6" have entirely different histories.
786178195b
...
a6907d7a91
@ -1,5 +1,3 @@
|
||||
Require at
|
||||
Require atd
|
||||
Sleep 500ms
|
||||
Type "at teatime"
|
||||
Enter
|
||||
|
@ -1,38 +0,0 @@
|
||||
---
|
||||
title: "hard links"
|
||||
tags: [ "basics", "links" ]
|
||||
---
|
||||
|
||||
A hard link is one file which exists in multiple locations.
|
||||
|
||||
Each file has an ID, which is kept on the hard disk's partition.
|
||||
Each hard link has the same ID, because they are the same file.
|
||||
This ID is called the 'inode'.
|
||||
|
||||
Create a file, and a hard link:
|
||||
|
||||
```bash
|
||||
fortune > $file_1
|
||||
mkdir -p x/y/z/
|
||||
ln $file_1 x/y/z/$file_2
|
||||
```
|
||||
Have a long look at the file with the `-l` flag, and check the inode with `-i`:
|
||||
|
||||
```bash
|
||||
ls -li $file_1 x/y/z/$file_2
|
||||
```
|
||||
|
||||
Since they are the same file, you can make a change to one, and it changes both:
|
||||
|
||||
```bash
|
||||
fortune | tee x/y/z/$file_2
|
||||
cat $file_1
|
||||
cat x/y/z/$file_2
|
||||
```
|
||||
|
||||
# Danger Zone
|
||||
|
||||
- hard links will not work on directories, only standard files and fifos.
|
||||
- `git` will destroy and remake files, so it will not respect hard links.
|
||||
- Files cannot have a hard link on another disk partition, because the inode is stored on each partition.
|
||||
|
@ -1,9 +1,19 @@
|
||||
---
|
||||
title: "links"
|
||||
tags: [ "basics", "links" ]
|
||||
tags: [ "Documentation", "Basics" ]
|
||||
---
|
||||
Link from X to Y.
|
||||
|
||||
There are two types:
|
||||
```bash
|
||||
ln -s X ../otherdir/Y
|
||||
```
|
||||
|
||||
If you want a hard link, this will make a single file exist in two locations.
|
||||
If it is deleted in one location, it continues to exist in the other.
|
||||
|
||||
```bash
|
||||
ln *X* *Y*
|
||||
```
|
||||
|
||||
Both files must be on the same hard drive, as they have the same inode (check this with `ls -i file`).
|
||||
|
||||
- [Soft links](soft_links.md)
|
||||
- [Hard links](hard_links.md)
|
||||
|
@ -1,72 +0,0 @@
|
||||
---
|
||||
title: "soft links"
|
||||
tags: [ "basics", "links" ]
|
||||
---
|
||||
A soft link is a file which says how to go to another file.
|
||||
When a program encounters a soft link, it will make a guess at whether it should ignore it, or try to get to that file.
|
||||
|
||||
To make a soft link to a file in the current directory, linking is easy:
|
||||
|
||||
```bash
|
||||
fortune > $file_1
|
||||
ln -s $file_1 $link_1
|
||||
```
|
||||
|
||||
Now imagine your directory looks like this:
|
||||
|
||||
```
|
||||
dir_0/
|
||||
├── dir_1
|
||||
│ └── file_1
|
||||
├── dir_2
|
||||
│ └── file_1
|
||||
├── file_1
|
||||
└── link_1
|
||||
|
||||
```
|
||||
|
||||
Inside `dir_1`, making a soft link to `dir_0/file_1` would mean putting the directions to that file:
|
||||
|
||||
```bash
|
||||
cd dir_1
|
||||
ln -s ../file_1 link_1
|
||||
```
|
||||
|
||||
The real content of the file is just '`../file_1`, so making it from another directory would mean writing exactly the same address to that file:
|
||||
|
||||
```bash
|
||||
ln -s ../file_1 dir_2/link_2
|
||||
```
|
||||
|
||||
Both symlinks are identical, except for the name.
|
||||
|
||||
```
|
||||
dir_0/
|
||||
├── dir_1
|
||||
│ ├── file_1
|
||||
│ └── link_1 <-- This one points to ../file_1
|
||||
├── dir_2
|
||||
│ ├── file_1
|
||||
│ └── link_2 <-- This one points to ../file_1 as well.
|
||||
└── file_2
|
||||
|
||||
```
|
||||
|
||||
Since it's just an address, you can delete the original file, then make another.
|
||||
|
||||
```bash
|
||||
rm file_1
|
||||
ls -l dir_1/
|
||||
fortune > file_1
|
||||
cat dir_2/link_2
|
||||
fortune | tee -a file_1
|
||||
cat dir_1/link_1
|
||||
```
|
||||
|
||||
Last, let's make a link from `dir_2/link_2` to `dir_1/file_1` (this will delete the old link):
|
||||
|
||||
```bash
|
||||
ln -s -f ../dir_1/file_1 dir_2/link_2
|
||||
cat dir_2/link_2
|
||||
```
|
||||
|
@ -68,11 +68,3 @@ ntpq -p
|
||||
|
||||
Usually this is run as a service, so just start that service.
|
||||
|
||||
# Force Reset
|
||||
|
||||
If your clock drifts too far from the right time, it will not reset happily.
|
||||
For it to reset like this:
|
||||
|
||||
```bash
|
||||
sudo ntpd -q -g -x -n
|
||||
```
|
||||
|
@ -124,7 +124,7 @@ Refreshing keys will tell you if some key you have contains a signature from som
|
||||
gpg --refresh-keys
|
||||
```
|
||||
|
||||
You can use the [crontab](../../basics/cron.md) to refresh keys.
|
||||
You can use the [crontab](../basics/cron.md) to refresh keys.
|
||||
|
||||
# Export
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
---
|
||||
title: "PDF Metadata Erasure"
|
||||
tags: [ "Documentation", "Metadata", "Ghost Script" ]
|
||||
---
|
||||
|
||||
Make a text file called 'pdfmark.txt'.
|
||||
|
||||
|
||||
```text
|
||||
[ /Title ()
|
||||
/Author ()
|
||||
/Subject ()
|
||||
/Creator ()
|
||||
/ModDate ()
|
||||
/Producer ()
|
||||
/Keywords ()
|
||||
/CreationDate ()
|
||||
/DOCINFO pdfmark
|
||||
```
|
||||
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
gs -o output.pdf -sDEVICE=pdfwrite "$FILE".pdf pdfmark.txt
|
||||
```
|
@ -1,69 +0,0 @@
|
||||
---
|
||||
title: "Soft Serve through https"
|
||||
tags: [ "data", "git" ]
|
||||
---
|
||||
|
||||
## `http` Setup
|
||||
|
||||
In this example, the port used is `23231`, but it can be anything.
|
||||
Open `/var/lib/soft-serve/data/config.yaml` and make sure the `http` section looks like this:
|
||||
|
||||
```
|
||||
# The HTTP server configuration.
|
||||
http:
|
||||
# The address on which the HTTP server will listen.
|
||||
listen_addr: ":23232"
|
||||
|
||||
# The path to the TLS private key.
|
||||
tls_key_path: ""
|
||||
|
||||
# The path to the TLS certificate.
|
||||
tls_cert_path: ""
|
||||
|
||||
# The public URL of the HTTP server.
|
||||
# This is the address that will be used to clone repositories.
|
||||
# Make sure to use https:// if you are using TLS.
|
||||
public_url: "http://localhost:23232"
|
||||
|
||||
```
|
||||
|
||||
Restart the `soft-serve` service, then check it's working by cloning from localhost:
|
||||
|
||||
```bash
|
||||
git clone http://localhost:23232/${some_repo}.git
|
||||
```
|
||||
|
||||
## `https` Setup
|
||||
|
||||
Put this file at `/etc/nginx/sites-enabled/$DOMAIN.tld`, then set up standard certificates with [nginx](../networking/website/nginx.md).
|
||||
|
||||
(replace `${DOMAIN_NAME}` with your domain's name).
|
||||
|
||||
```
|
||||
server {
|
||||
listen 80;
|
||||
server_name ${DOMAIN_NAME};
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:23232;
|
||||
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 ${DOMAIN_NAME};
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:23232;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
@ -1,19 +0,0 @@
|
||||
---
|
||||
title: "deduplicate"
|
||||
tags: [ "system", "deduplicate", "duplicates", "maintenance" ]
|
||||
---
|
||||
|
||||
`rdfind`: find duplicate files, then delete them, or turn them into links.
|
||||
|
||||
Ask if a directory has duplicates (`rdfind` will not delete anything):
|
||||
|
||||
```bash
|
||||
rdfind $dir
|
||||
$EDITOR results.txt
|
||||
```
|
||||
|
||||
Replace the duplicated files with [hard links](../basics/hard_links.md).
|
||||
|
||||
```bash
|
||||
rdfind -makehardlinks true $dir
|
||||
```
|
@ -22,7 +22,6 @@ And overwrite all metadata:
|
||||
```bash
|
||||
exiftool -all= -overwrite_original -ext jpg .
|
||||
```
|
||||
(NB: This does not work on pdf data. See [here](pdf_erasure.md) for erasing all pdf data)
|
||||
|
||||
Or just GPS data:
|
||||
|
||||
@ -37,4 +36,3 @@ identify -verbose
|
||||
```
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user