14-11-2023

This commit is contained in:
2023-11-14 20:35:51 +01:00
parent 5b45dc0863
commit d78f93eed2
93 changed files with 8181 additions and 538 deletions

View File

@@ -0,0 +1,51 @@
# mdfind
#### find + Spotlight
#### Opérateurs logiques: AND, OR, NOT
Par nom de fichier: `name:<keyword>`
Par créateur: `author:<author>`
Par date: `date:today` (today, yesterday et tomorrow)
Par de création: `created:12/25/07`
Par date de modification: `modified:&lt;11/30/06`
Par type de fichier:
| Aliases | kind:alias |
| ----------------- | --------------------------------------------- |
| Applications | kind:application, kind:applications, kind:app |
| Audio | kind:audio |
| Bookmarks | kind:bookmark, kind:bookmarks |
| Browser history | kind:history |
| Contacts | kind:contact, kind:contacts |
| E-mail messages | kind:email, kind:emails, kind:mail message |
| Folders | kind:folder, kind:folders, kind:fol |
| Fonts | kind:font, kind:fonts |
| iCal Events | kind:event, kind:events |
| iCal To-Do Items | kind:todo, kind:todos, kind:to do |
| Images | kind:image, kind:images |
| JPEG files | kind:jpeg |
| Keynote files | kind:keynote |
| Movies | kind:movie, kind:movies |
| MP3 files | kind:mp3 |
| Music | kind:music |
| Numbers documents | kind:numbers |
| Pages documents | kind:pages |
| PDF files | kind:pdf, kind:pdfs |
| PowerPoint files | kind:powerpoint |
| Preference panes | kind:preference, kind:preferences |
| Presentations | kind:presentation, kind:presentations |
| QuickTime files | kind:quicktime |
| TIFF files | kind:tiff |
| Word documents | kind:word |

View File

@@ -0,0 +1,117 @@
# Reachable
### ping
```bash
ping -c1 -W1 -q maboiteverte.fr
PING maboiteverte.fr (212.227.191.167): 56 data bytes
--- maboiteverte.fr ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
# immédiat
echo $?
0
```
```bash
ping -c1 -W1 -q clicclac.synology.me
PING clicclac.synology.me (192.168.2.7): 56 data bytes
--- clicclac.synology.me ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
# immédiat
echo $?
2
```
```bash
ping -c1 -W1 -q google.fr
PING google.fr (216.58.213.67): 56 data bytes
--- google.fr ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 19.936/19.936/19.936/0.000 ms
echo $?
0
```
### nmap
```bash
nmap maboiteverte.fr -PN -p 22 | grep open
22/tcp open ssh
# immédiat
echo $?
0
```
```bash
nmap clicclac.synology.me -PN -p 42666 | grep open
# 2s
echo $?
1
```
```bash
if [ "$?" = 0 ]
then
echo "Host found"
else
echo "Host not found"
fi
```
# nc
```bash
nc -z -G 2 maboiteverte.fr 22
Connection to maboiteverte.fr port 22 [tcp/ssh] succeeded!
# immédiat
echo $?
0
```
```bash
nc -z -G 2 clicclac.synology.me 42666
# 3s
echo $?
1
```
# ssh
```bash
&>/dev/null ssh bruno@maboiteverte.fr true && echo "up" || echo "down"
up
# 2s
```
```bash
&>/dev/null ssh bruno@clicclac.synology.me true && echo "up" || echo "down"
down
# long 75s
```

View File

@@ -74,6 +74,33 @@ $ xattr -d com.apple.quarantine /Users/bruno/.local/bin/convert-videos-for-plex.
#### Erreur: '/usr/bin/env : mauvais interpréteur: Operation not permitted'
```bash
/usr/local/bin/kymsu2: /Users/bruno/.kymsu/plugins.d/00-kymsu.sh : /usr/bin/env : mauvais interpréteur: Operation not permitted
```
```bash
$ xattr -l 00-kymsu.sh
com.apple.TextEncoding: UTF-8;134217984
com.apple.lastuseddate#PS: J<><4A>b
com.apple.provenance:
com.apple.quarantine: 0086;62df747e;BBEdit;
```
Pour supprimer la quarantaine:
```bash
$ xattr -d com.apple.quarantine 00-kymsu.sh
$ xattr -l 00-kymsu.sh
com.apple.TextEncoding: UTF-8;134217984
com.apple.lastuseddate#PS: J<><4A>b
com.apple.provenance:
```
#### Raccourcis:
Aller en début de ligne: `CTRL+A`

View File

@@ -0,0 +1,82 @@
# trash
### trash
http://hasseg.org/trash/
```bash
brew install trash
```
```bash
trash <file>
```
### macos-trash
https://github.com/sindresorhus/macos-trash
```bash
brew install macos-trash
```
```bash
trash <file>
```
###
### AppleScript
```bash
osascript -e "tell application \"Finder\" to delete POSIX file \"${PWD}/${InputFile}\""
```
```bash
trash() (
: "${1:?}"
case $1 in
(/*) FNAME="$1" ;;
(*) FNAME="$(pwd)/$1"
esac
export FNAME
exec osascript <<-EOF >/dev/null
set fName to system attribute "FNAME"
tell application "Finder" to delete my (POSIX file fName)
EOF
)
```
```bash
function rem {
for b in "$@"
do
osascript -e "tell app \"Finder\" to delete POSIX file \"${PWD}/$b\""
done
}
```
```bash
trash() { mv -fv "$@" ~/.Trash/ ; }
#
```
```
/Volumes/Sharon/Windows trash Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx
copied 'Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx' -> '/Users/bruno/.Trash/Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx'
removed 'Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx'
/Volumes/Sharon/Windows 25s 09:06:33
```