-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Synced vaults: - commons-dws-public Dendron version: 0.124.0 Hostname: vpn-client-41-147.unifr.ch
- Loading branch information
Showing
8 changed files
with
551 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
id: Z7Wi64fLEKDGZTzIBdT9y | ||
title: Csv | ||
desc: '' | ||
updated: 1639942661275 | ||
created: 1636553893835 | ||
--- | ||
https://www.stefaanlippens.net/pretty-csv.html | ||
|
||
|
||
placeholder (testing submodule) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
id: dhqqlr5eevc7jennaygo5cd | ||
title: Find | ||
desc: '' | ||
updated: 1715236340664 | ||
created: 1715236288747 | ||
--- | ||
|
||
### Count number of directories in current directory | ||
|
||
```bash | ||
find . -maxdepth 1 -type d | wc -l | ||
``` | ||
|
||
Details at https://stackoverflow.com/a/17648137 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
id: l1i6gksd9rbsljpkpa5c0s5 | ||
title: Lowercase | ||
desc: '' | ||
updated: 1647785912065 | ||
created: 1647785862905 | ||
--- | ||
|
||
https://stackoverflow.com/a/7787159/4908629 | ||
|
||
|
||
❗ Mind were you are doing this ! It's not possible to go back :P | ||
|
||
|
||
for f in *; do mv "$f" "$f.tmp"; mv "$f.tmp" "`echo $f | tr "[:upper:]" "[:lower:]"`"; done | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
id: QnOOo86260d85beTWwNIt | ||
title: Sed_bash | ||
desc: '' | ||
updated: 1682950627290 | ||
created: 1609604978319 | ||
--- | ||
|
||
[[#oneday|tag.oneday]] | ||
automate with a sed script ? the bib cleaning | ||
|
||
Some sed black magic | ||
|
||
```bash | ||
echo "\{" | sed "s|\\\{|\\\'{|" | ||
```` | ||
Double \\ to escape the \\ | ||
|
||
And repeat | ||
|
||
```bash | ||
echo "\{jhdgjshgjhfsjdhgf\}" | sed "s|\\\{|\\\'{|g; s|\\\}|\\\'}|g;" | ||
```` | ||
Now add input and outputs | ||
```bash | ||
sed "s|\\\{|\\\'{|g; s|\\\}|\\\'}|g" library.bib > library_formatted.bib | ||
``` | ||
|
||
We'll try to automatize the process using https://stackoverflow.com/a/13807906 fswatch and alternative to inotifywatch on linux https://linux.die.net/man/1/inotifywatch | ||
|
||
So here is the small bash script. It will take the command line arg 1 and add the _formatted prefix to it. Could be cleaner and directly extract the filename to accomodate for various type of extension. Not the point here. If any body has an idea, please contribute ! :point_down: | ||
|
||
|
||
```bash | ||
#!/bin/bash | ||
sed "s|\\\{|\\\'{|g; s|\\\}|\\\'}|g" "$1" > "${1%.bib}_formatted.bib" | ||
``` | ||
|
||
```bash | ||
#!/bin/bash | ||
|
||
# fullfilename="$(basename $1)" | ||
# extension="${fullfilename##*.}" | ||
# filename="${fullfilename%.*}" | ||
|
||
# echo $fullfilename | ||
# echo $extension | ||
# echo $filename | ||
|
||
#echo "File added: " "$(basename $1)" "$(basename $1)" | ||
sed "s|\\\{|\\\'{|g; s|\\\}|\\\'}|g" "$1" > "./formatted_bib/${filename}_formatted.bib" | ||
|
||
```` | ||
|
||
|
||
|
||
|
||
fswatch has been somehow a nightmare to understand ... | ||
|
||
to trouble shoot use the follwoing line to be sure of what exactly you take as input | ||
|
||
```bash | ||
fswatch -0 ./mendeley_output/ | xargs -0 -n1 -I{} echo "{}" | ||
``` | ||
|
||
## quick replace in text file | ||
|
||
`sed -i 's/original/new/g' file.txt` | ||
|
||
sed -i'' 's/CHARGE=1-/CHARGE=-1/g' /Users/pma/01_large_files/mgf/isdb_neg.mgf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
id: IG6I7CXHNtcsZV3idu0Z8 | ||
title: Tar | ||
desc: '' | ||
updated: 1611406532608 | ||
created: 1609690553137 | ||
--- | ||
|
||
|
||
## tar command lines | ||
|
||
To create a tar.gz archive from a given folder you can use the following command. This will compress the contents of source-folder-name to a tar.gz | ||
archive named tar-archive-name.tar.gz | ||
|
||
```bash | ||
tar -zcvf tar-archive-name.tar.gz source-folder-name | ||
``` | ||
|
||
To extract a tar.gz compressed archive you can use the following command | ||
|
||
```bash | ||
tar -zxvf tar-archive-name.tar.gz | ||
``` | ||
|
||
If its a gzipped file | ||
|
||
```bash | ||
gzip -d tar-archive-name.tar.gz | ||
``` | ||
|
||
This will extract the archive to the folder tar-archive-name. | ||
|
||
To Preserve permissions | ||
|
||
```bash | ||
tar -pcvzf tar-archive-name.tar.gz source-folder-name | ||
``` | ||
|
||
Switch the ‘c’ flag to an ‘x’ to extract (uncompress). | ||
|
||
```bash | ||
tar -pxvzf tar-archive-name.tar.gz | ||
``` | ||
|
||
|
||
sudo certbot --authenticator standalone --installer nginx -d directus.dbgi.org --pre-hook "service nginx stop" --post-hook "service nginx start" |
Oops, something went wrong.