Compare commits
11 Commits
dea8407397
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 0094d71a6f | |||
| 2a39a846ab | |||
|
b29574668f
|
|||
| b2e684f55d | |||
| bfa67e5aed | |||
| 60d06da8df | |||
| 6adc6f1f71 | |||
| 0957a88ac8 | |||
| adb4c0029e | |||
| c9a35007ac | |||
| faa6fea904 |
436
Installed.md
436
Installed.md
@@ -1,436 +0,0 @@
|
||||
# Apps, package, scripts installed:
|
||||
|
||||
## Homebrew
|
||||
|
||||
### Tap:
|
||||
cpbotha/marmaduke-chromium
|
||||
homebrew/apache
|
||||
homebrew/bundle
|
||||
homebrew/cask
|
||||
homebrew/cask-versions
|
||||
homebrew/core
|
||||
homebrew/dupes
|
||||
homebrew/services
|
||||
homebrew/versions
|
||||
linux-noah/noah
|
||||
tideways/profiler
|
||||
vapor/tap
|
||||
|
||||
### Packages:
|
||||
apr
|
||||
apr-util
|
||||
argon2
|
||||
argyll-cms
|
||||
aspell
|
||||
atk
|
||||
autoconf
|
||||
bash-completion
|
||||
boost
|
||||
borg
|
||||
brew-pip
|
||||
brotli
|
||||
c-ares
|
||||
cabextract
|
||||
cairo
|
||||
chmlib
|
||||
cmake
|
||||
composer
|
||||
ctls
|
||||
curl
|
||||
curl-openssl
|
||||
dashing
|
||||
doxygen
|
||||
emscripten
|
||||
faac
|
||||
ffmpeg
|
||||
fontconfig
|
||||
freetds
|
||||
freetype
|
||||
fribidi
|
||||
gdbm
|
||||
gdk-pixbuf
|
||||
gettext
|
||||
ghostscript
|
||||
git-ftp
|
||||
glib
|
||||
gmp
|
||||
gnu-getopt
|
||||
gnu-tar
|
||||
go
|
||||
gobject-introspection
|
||||
graphite2
|
||||
gtk+
|
||||
handbrake
|
||||
harfbuzz
|
||||
hicolor-icon-theme
|
||||
highlight
|
||||
httpd
|
||||
hugo
|
||||
icdiff
|
||||
icu4c
|
||||
imap-uw
|
||||
jansson
|
||||
jemalloc
|
||||
jpeg
|
||||
jq
|
||||
lame
|
||||
libbpg
|
||||
libev
|
||||
libevent
|
||||
libffi
|
||||
libiconv
|
||||
libidn
|
||||
libidn2
|
||||
libmetalink
|
||||
libogg
|
||||
libpng
|
||||
libpq
|
||||
libressl
|
||||
libsodium
|
||||
libssh2
|
||||
libtiff
|
||||
libtool
|
||||
libunistring
|
||||
libvorbis
|
||||
libvpx
|
||||
libxml2
|
||||
libyaml
|
||||
libzip
|
||||
little-cms2
|
||||
lua
|
||||
makedepend
|
||||
mariadb
|
||||
mas
|
||||
md5deep
|
||||
md5sha1sum
|
||||
mongodb
|
||||
mono
|
||||
mtr
|
||||
multitail
|
||||
nano
|
||||
ncurses
|
||||
nghttp2
|
||||
nginx
|
||||
nmap
|
||||
noahstrap
|
||||
node
|
||||
noti
|
||||
nvm
|
||||
oniguruma
|
||||
openldap
|
||||
openssl
|
||||
openssl@1.1
|
||||
opus
|
||||
p7zip
|
||||
packer
|
||||
pandoc
|
||||
pango
|
||||
pcre
|
||||
pcre2
|
||||
perl
|
||||
php
|
||||
php-code-sniffer
|
||||
php@7.2
|
||||
phpmyadmin
|
||||
pixman
|
||||
pkg-config
|
||||
pv
|
||||
py2cairo
|
||||
pygobject
|
||||
pygtk
|
||||
python
|
||||
python3
|
||||
python@2
|
||||
readline
|
||||
rsync
|
||||
rtmpdump
|
||||
sdl2
|
||||
shellcheck
|
||||
snappy
|
||||
spdylay
|
||||
sphinx-doc
|
||||
sqlite
|
||||
ssh-copy-id
|
||||
tcl-tk
|
||||
terminal-notifier
|
||||
theora
|
||||
tidy-html5
|
||||
tkdiff
|
||||
trash
|
||||
unixodbc
|
||||
unrar
|
||||
vapor
|
||||
webp
|
||||
wget
|
||||
wine
|
||||
winetricks
|
||||
wp-cli
|
||||
x264
|
||||
x265
|
||||
xvid
|
||||
xz
|
||||
yuicompressor
|
||||
zlib
|
||||
|
||||
### Casks:
|
||||
0xed
|
||||
airy
|
||||
alfred
|
||||
appcleaner
|
||||
atom
|
||||
bartender
|
||||
basictex
|
||||
batchmod
|
||||
beamer
|
||||
bettertouchtool
|
||||
betterzip
|
||||
bitwarden
|
||||
cakebrew
|
||||
cloudtv
|
||||
coconutbattery
|
||||
controlplane
|
||||
cookie
|
||||
cryptomator
|
||||
dash
|
||||
diffmerge
|
||||
disk-drill
|
||||
diskmaker-x
|
||||
displaycal
|
||||
docker
|
||||
easyfind
|
||||
etcher
|
||||
ff-works
|
||||
firefox-developer-edition
|
||||
fork
|
||||
github
|
||||
google-earth-pro
|
||||
graphicconverter
|
||||
handbrake
|
||||
harmony
|
||||
houdahgeo
|
||||
houdahgps
|
||||
hubic
|
||||
ifilex
|
||||
iina
|
||||
invisor-lite
|
||||
iterm2
|
||||
itsycal
|
||||
kdiff3
|
||||
kitematic
|
||||
launchcontrol
|
||||
lyn
|
||||
marked
|
||||
marmaduke-chromium
|
||||
meta
|
||||
molotov
|
||||
mplayerx
|
||||
mpv
|
||||
musicbrainz-picard
|
||||
name-mangler
|
||||
nextcloud
|
||||
nvalt
|
||||
onyx
|
||||
pacifist
|
||||
platypus
|
||||
plex-media-player
|
||||
plexamp
|
||||
poedit
|
||||
progressive-downloader
|
||||
purevpn
|
||||
qlcolorcode
|
||||
qlmarkdown
|
||||
qlstephen
|
||||
qownnotes
|
||||
screens
|
||||
stellarium
|
||||
subler
|
||||
sublime
|
||||
sublime-text
|
||||
superduper
|
||||
suspicious-package
|
||||
syncmate
|
||||
timemachineeditor
|
||||
tower2
|
||||
transmission
|
||||
transmit
|
||||
tripmode
|
||||
typora
|
||||
vagrant
|
||||
visual-studio-code
|
||||
vivaldi
|
||||
vlc
|
||||
vnc-viewer
|
||||
waltr
|
||||
wordpresscom
|
||||
xact
|
||||
xld
|
||||
xnconvert
|
||||
xnviewmp
|
||||
xquartz
|
||||
yate
|
||||
|
||||
## mas (Mac App Store)
|
||||
|
||||
Mastock (403176537)
|
||||
SubEthaEdit (728530824)
|
||||
App Cleaner (1013897218)
|
||||
JSON Validator (457563999)
|
||||
Speedtest (1153157709)
|
||||
ChmPages (1164062917)
|
||||
Startup Disk Full Fixer (1346655838)
|
||||
1Blocker (1107421413)
|
||||
iScheduleTimeMachine (798826767)
|
||||
Reeder (880001334)
|
||||
MCG (799178412)
|
||||
ShutterCount (720123827)
|
||||
Colibri (1178295426)
|
||||
CleanMyDrive 2 (523620159)
|
||||
iMovie (408981434)
|
||||
MarkNotes (1059403637)
|
||||
Router (1229416813)
|
||||
Icon Slate (439697913)
|
||||
EOBD-Facile (976630793)
|
||||
Monosnap (540348655)
|
||||
Audio Converter Lite (703369642)
|
||||
EtreCheck (1423715984)
|
||||
SSH Config Editor (1109319285)
|
||||
RulerSwift (1102341786)
|
||||
Notebook (1173152781)
|
||||
SoundConverter (413890028)
|
||||
HTTP Client (418138339)
|
||||
Microsoft Remote Desktop (1295203466)
|
||||
iHex (909566003)
|
||||
LaunchD Task Scheduler (620249105)
|
||||
gps4cam (704400176)
|
||||
GhosteryLite (1436953057)
|
||||
Flick for Netflix (1120947587)
|
||||
Xcode (497799835)
|
||||
PhotoSync (418818452)
|
||||
Photo Transfer App (509182449)
|
||||
ExifPurge (784466108)
|
||||
iMazing HEIC Converter (1292198261)
|
||||
GarageBand (682658836)
|
||||
SecSign ID (1038409057)
|
||||
MDB Tool - For Microsoft Access (513995545)
|
||||
2STP Companion (1055307502)
|
||||
Pages (409201541)
|
||||
Together 3 (641534696)
|
||||
Simplenote (692867256)
|
||||
Numbers (409203825)
|
||||
Network Speed Tester (1217419133)
|
||||
The Unarchiver (425424353)
|
||||
Stock + (527270840)
|
||||
Compressify (414830806)
|
||||
Keynote (409183694)
|
||||
iCHM (1243909868)
|
||||
GPX Editor (924782627)
|
||||
|
||||
## PECL extensions
|
||||
|
||||
apcu
|
||||
xdebug
|
||||
yaml
|
||||
|
||||
## Python packages
|
||||
|
||||
appnope
|
||||
autopep8
|
||||
backcall
|
||||
bleach
|
||||
Click
|
||||
decorator
|
||||
defusedxml
|
||||
Django
|
||||
entrypoints
|
||||
fontawesome-markdown
|
||||
html5lib
|
||||
ipykernel
|
||||
ipython
|
||||
ipython-genutils
|
||||
ipywidgets
|
||||
jedi
|
||||
Jinja2
|
||||
jsonschema
|
||||
jupyter
|
||||
jupyter-client
|
||||
jupyter-console
|
||||
jupyter-core
|
||||
livereload
|
||||
Markdown
|
||||
MarkupSafe
|
||||
material
|
||||
mistune
|
||||
mkdocs
|
||||
mkdocs-bootstrap
|
||||
mkdocs-material
|
||||
mod-wsgi
|
||||
nbconvert
|
||||
nbformat
|
||||
notebook
|
||||
pandocfilters
|
||||
parso
|
||||
pep8
|
||||
pexpect
|
||||
pickleshare
|
||||
pip
|
||||
pipdeptree
|
||||
prometheus-client
|
||||
prompt-toolkit
|
||||
ptyprocess
|
||||
pycodestyle
|
||||
Pygments
|
||||
pymdown-extensions
|
||||
python-dateutil
|
||||
pytz
|
||||
PyYAML
|
||||
pyzmq
|
||||
qtconsole
|
||||
Send2Trash
|
||||
setuptools
|
||||
simplegeneric
|
||||
six
|
||||
terminado
|
||||
terminaltables
|
||||
testpath
|
||||
tornado
|
||||
traitlets
|
||||
wcwidth
|
||||
webencodings
|
||||
wheel
|
||||
widgetsnbextension
|
||||
yolk
|
||||
yolk3k
|
||||
|
||||
## Atom packages
|
||||
|
||||
Solis
|
||||
dash
|
||||
french-menu
|
||||
git-plus
|
||||
|
||||
## Node.js packages
|
||||
|
||||
### Global:
|
||||
ajv-keywords
|
||||
cli
|
||||
dploy
|
||||
ghost
|
||||
ghost-cli
|
||||
npm
|
||||
npm-install-peers
|
||||
yarn
|
||||
### Local:
|
||||
lg-autoplay
|
||||
─ jquery
|
||||
lg-fullscreen
|
||||
lg-hash
|
||||
lg-pager
|
||||
lg-share
|
||||
lg-thumbnail
|
||||
lg-video
|
||||
lg-zoom
|
||||
lightgallery
|
||||
livephotoskit
|
||||
picturefill
|
||||
uninstall-all-modules
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo -e "\033[1mApache Tools: \033[0m"
|
||||
|
||||
editeur=/usr/local/bin/bbedit
|
||||
|
||||
v_apa=$(httpd -V | grep 'SERVER_CONFIG_FILE')
|
||||
conf_apa=$(echo "$v_apa" | awk -F "\"" '{print $2}')
|
||||
v_php=$(php --info | grep -E 'usr.*ini')
|
||||
conf_php=$(echo "$v_php" | grep 'Loaded Configuration File' | awk '{print $NF}')
|
||||
v_mysql=$(mysql --help | grep -A1 'Default options')
|
||||
|
||||
options=(
|
||||
"Apache (r)estart"
|
||||
"(E)dit httpd.conf"
|
||||
"error_log Apache"
|
||||
"access_log Apache"
|
||||
"Edit (P)HP.ini"
|
||||
"Apache/PHP/MySQL (V)ersion"
|
||||
"Apache/PHP/MySQL (C)onfiguration files"
|
||||
"(Q)uit"
|
||||
)
|
||||
|
||||
|
||||
select option in "${options[@]}"; do
|
||||
case "$REPLY" in
|
||||
1|r|R) sudo apachectl -k restart ;;
|
||||
2|e|E) "$editeur" "$conf_apa" ;; # httpd.conf
|
||||
3) tail -f /usr/local/var/log/httpd/error_log ;;
|
||||
4) tail -f /usr/local/var/log/httpd/access_log ;;
|
||||
5|p|P) "$editeur" "$conf_php" ;; # php.ini
|
||||
6|v|V) apachectl -v && echo ' ' && php -v && echo ' ' && mysql --version ;;
|
||||
7|c|C) echo -e "\033[4mApache:\033[0m " && echo $v_apa && echo ' ' && echo -e "\033[4mPHP:\033[0m " && echo $v_php && echo ' ' && echo -e "\033[4mMySQL:\033[0m " && echo $v_mysql ;;
|
||||
8|q|Q) break ;;
|
||||
esac
|
||||
done
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" == "-h" ]; then
|
||||
echo -e "\033[93mbackup-conf.sh\033[0m"
|
||||
echo "Backup several files and folders:"
|
||||
echo
|
||||
echo " - httpd.conf"
|
||||
echo " - httpd-vhosts.conf"
|
||||
echo " - php.ini"
|
||||
echo " - .bash_profile"
|
||||
echo " - .gitconfig"
|
||||
echo " - .wg++"
|
||||
echo " - .nanorc, .nanosyntax"
|
||||
echo " - .ssh"
|
||||
echo " - .vnc"
|
||||
echo " - .kymsu"
|
||||
echo
|
||||
echo "USAGE: backup-conf"
|
||||
echo
|
||||
echo " -h display this help"
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
|
||||
APACHE=$(httpd -v | grep "version" | awk '{print $3}' | awk -F/ '{print $2}')
|
||||
PHP=$(php -v | grep "cli" | awk '{print $2}')
|
||||
|
||||
cd /Users/bruno/Documents/config\ web\ \(homebrew\)/
|
||||
|
||||
if [ ! -d "apache $APACHE" ]; then mkdir "apache $APACHE"; fi
|
||||
cp /usr/local/etc/httpd/httpd.conf /Users/bruno/Documents/config\ web\ \(homebrew\)/apache\ $APACHE/
|
||||
cp /usr/local/etc/httpd/extra/httpd-vhosts.conf /Users/bruno/Documents/config\ web\ \(homebrew\)/apache\ $APACHE/
|
||||
|
||||
if [ ! -d "php $PHP" ]; then mkdir "php $PHP"; fi
|
||||
cp /usr/local/etc/php/7.2/php.ini /Users/bruno/Documents/config\ web\ \(homebrew\)/php\ $PHP/
|
||||
|
||||
cp /Users/bruno/.bash_profile /Users/bruno/Documents/Backups/Bruno/
|
||||
cp /Users/bruno/.gitconfig /Users/bruno/Documents/Backups/Bruno/
|
||||
cp /Users/bruno/.wg++/WebGrab++.config.xml /Users/bruno/Documents/Backups/Bruno/
|
||||
cp /Users/bruno/.nanorc /Users/bruno/Documents/Backups/Bruno/
|
||||
cp -R /Users/bruno/.nanosyntax /Users/bruno/Documents/Backups/Bruno/
|
||||
cp -R /Users/bruno/.ssh /Users/bruno/Documents/Backups/Bruno/
|
||||
cp -R /Users/bruno/.vnc /Users/bruno/Documents/Backups/Bruno/
|
||||
cp -R /Users/bruno/.kymsu /Users/bruno/Documents/Backups/Bruno/
|
||||
terminal-notifier -title 'Backups' -message 'Sauvegarde terminée !' -sound 'Glass'
|
||||
28
color-bash.sh
Executable file
28
color-bash.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# https://misc.flogisoft.com/bash/tip_colors_and_formatting
|
||||
|
||||
# prints a color table of 8bg * 8fg * 2 states (regular/bold)
|
||||
echo
|
||||
echo Table for 16-color terminal escape sequences.
|
||||
echo Replace ESC with \\033 in bash.
|
||||
echo
|
||||
echo "Background | Foreground colors"
|
||||
echo "---------------------------------------------------------------------"
|
||||
for((bg=40;bg<=47;bg++)); do
|
||||
for((bold=0;bold<=1;bold++)) do
|
||||
echo -en "\033[0m"" ESC[${bg}m | "
|
||||
for((fg=30;fg<=37;fg++)); do
|
||||
if [ $bold == "0" ]; then
|
||||
echo -en "\033[${bg}m\033[${fg}m [${fg}m "
|
||||
else
|
||||
echo -en "\033[${bg}m\033[1;${fg}m [1;${fg}m"
|
||||
fi
|
||||
done
|
||||
echo -e "\033[0m"
|
||||
done
|
||||
echo "--------------------------------------------------------------------- "
|
||||
done
|
||||
|
||||
echo
|
||||
echo
|
||||
45
img.sh
Executable file
45
img.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: $(basename $0) file ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function load_version() {
|
||||
if [ -z ${IT2DL_BASE64_VERSION+x} ]; then
|
||||
export IT2DL_BASE64_VERSION=$(base64 --version 2>&1)
|
||||
fi
|
||||
}
|
||||
|
||||
function b64_encode() {
|
||||
load_version
|
||||
if [[ "$IT2DL_BASE64_VERSION" =~ GNU ]]; then
|
||||
# Disable line wrap
|
||||
base64 -w0
|
||||
else
|
||||
base64
|
||||
fi
|
||||
}
|
||||
|
||||
#printf "\n\033]1337;File=;inline=1:`cat soco-cli-logo-01-large.png | base64`\a\n"
|
||||
#printf "\n\033]1337;File=;width=200px;inline=1:`cat soco-cli-logo-01-large.png | base64`\a\n"
|
||||
|
||||
|
||||
for fn in "$@"
|
||||
do
|
||||
if [ -r "$fn" ] ; then
|
||||
[ -d "$fn" ] && { echo "$fn is a directory"; continue; }
|
||||
#printf '\033]1337;File=name=%s;width=200px;inline=1' $(echo -n "$fn" | b64_encode)
|
||||
|
||||
printf "\n\033]1337;File=;width=200px;inline=1:`cat soco-cli-logo-01-large.png | base64`\a\n"
|
||||
|
||||
echo $?
|
||||
|
||||
|
||||
#wc -c "$fn" | awk '{printf "size=%d",$1}'
|
||||
#printf ":"
|
||||
#base64 < "$fn"
|
||||
#printf '\a'
|
||||
else
|
||||
echo File $fn does not exist or is not readable.
|
||||
fi
|
||||
done
|
||||
241
imgcat.sh
Normal file
241
imgcat.sh
Normal file
@@ -0,0 +1,241 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o pipefail
|
||||
|
||||
# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux;
|
||||
# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It
|
||||
# only accepts ESC backslash for ST. We use TERM instead of TMUX because TERM
|
||||
# gets passed through ssh.
|
||||
function print_osc() {
|
||||
if [[ $TERM == screen* || $TERM == tmux* ]]; then
|
||||
printf "\033Ptmux;\033\033]"
|
||||
else
|
||||
printf "\033]"
|
||||
fi
|
||||
}
|
||||
|
||||
# More of the tmux workaround described above.
|
||||
function print_st() {
|
||||
if [[ $TERM == screen* || $TERM == tmux* ]]; then
|
||||
printf "\a\033\\"
|
||||
else
|
||||
printf "\a"
|
||||
fi
|
||||
}
|
||||
|
||||
function load_version() {
|
||||
if [ -z ${IMGCAT_BASE64_VERSION+x} ]; then
|
||||
IMGCAT_BASE64_VERSION=$(base64 --version 2>&1)
|
||||
export IMGCAT_BASE64_VERSION
|
||||
fi
|
||||
}
|
||||
|
||||
function b64_encode() {
|
||||
load_version
|
||||
if [[ $IMGCAT_BASE64_VERSION =~ GNU ]]; then
|
||||
# Disable line wrap
|
||||
base64 -w0
|
||||
else
|
||||
base64
|
||||
fi
|
||||
}
|
||||
|
||||
function b64_decode() {
|
||||
load_version
|
||||
if [[ $IMGCAT_BASE64_VERSION =~ fourmilab ]]; then
|
||||
BASE64ARG=-d
|
||||
elif [[ $IMGCAT_BASE64_VERSION =~ GNU ]]; then
|
||||
BASE64ARG=-di
|
||||
else
|
||||
BASE64ARG=-D
|
||||
fi
|
||||
base64 $BASE64ARG
|
||||
}
|
||||
|
||||
# print_image filename inline base64contents print_filename width height preserve_aspect_ratio
|
||||
# filename: Filename to convey to client
|
||||
# inline: 0 or 1, if set to 1, the file will be displayed inline, otherwise, it will be downloaded
|
||||
# base64contents: Base64-encoded contents
|
||||
# print_filename: 0 or 1, if set to 1, print the filename after outputting the image
|
||||
# width: set output width of the image in character cells, pixels or percent
|
||||
# height: set output height of the image in character cells, pixels or percent
|
||||
# preserve_aspect_ratio: 0 or 1, if set to 1, fill the specified width and height as much as possible without stretching the image
|
||||
# file: Empty string or file type like "application/json" or ".js".
|
||||
function print_image() {
|
||||
print_osc
|
||||
printf "1337;File=inline=%s" "$2"
|
||||
printf ";size=%d" $(printf "%s" "$3" | b64_decode | wc -c)
|
||||
[ -n "$1" ] && printf ";name=%s" "$(printf "%s" "$1" | b64_encode)"
|
||||
[ -n "$5" ] && printf ";width=%s" "$5"
|
||||
[ -n "$6" ] && printf ";height=%s" "$6"
|
||||
[ -n "$7" ] && printf ";preserveAspectRatio=%s" "$7"
|
||||
[ -n "$8" ] && printf ";type=%s" "$8"
|
||||
printf ":%s" "$3"
|
||||
print_st
|
||||
printf '\n'
|
||||
[ "$4" == "1" ] && echo "$1"
|
||||
has_image_displayed=t
|
||||
}
|
||||
|
||||
function error() {
|
||||
errcho "ERROR: $*"
|
||||
}
|
||||
|
||||
function errcho() {
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
function show_help() {
|
||||
errcho
|
||||
errcho "Usage: imgcat [-p] [-n] [-W width] [-H height] [-r] [-s] [-u] [-t file-type] [-f] filename ..."
|
||||
errcho " cat filename | imgcat [-W width] [-H height] [-r] [-s]"
|
||||
errcho
|
||||
errcho "Display images inline in the iTerm2 using Inline Images Protocol"
|
||||
errcho
|
||||
errcho "Options:"
|
||||
errcho
|
||||
errcho " -h, --help Display help message"
|
||||
errcho " -p, --print Enable printing of filename or URL after each image"
|
||||
errcho " -n, --no-print Disable printing of filename or URL after each image"
|
||||
errcho " -u, --url Interpret following filename arguments as remote URLs"
|
||||
errcho " -f, --file Interpret following filename arguments as regular Files"
|
||||
errcho " -t, --type file-type Provides a type hint"
|
||||
errcho " -r, --preserve-aspect-ratio When scaling image preserve its original aspect ratio"
|
||||
errcho " -s, --stretch Stretch image to specified width and height (this option is opposite to -r)"
|
||||
errcho " -W, --width N Set image width to N character cells, pixels or percent (see below)"
|
||||
errcho " -H, --height N Set image height to N character cells, pixels or percent (see below)"
|
||||
errcho
|
||||
errcho " If you don't specify width or height an appropriate value will be chosen automatically."
|
||||
errcho " The width and height are given as word 'auto' or number N followed by a unit:"
|
||||
errcho " N character cells"
|
||||
errcho " Npx pixels"
|
||||
errcho " N% percent of the session's width or height"
|
||||
errcho " auto the image's inherent size will be used to determine an appropriate dimension"
|
||||
errcho
|
||||
errcho " If a type is provided, it is used as a hint to disambiguate."
|
||||
errcho " The file type can be a mime type like text/markdown, a language name like Java, or a file extension like .c"
|
||||
errcho " The file type can usually be inferred from the extension or its contents. -t is most useful when"
|
||||
errcho " a filename is not available, such as whe input comes from a pipe."
|
||||
errcho
|
||||
errcho "Examples:"
|
||||
errcho
|
||||
errcho " $ imgcat -W 250px -H 250px -s avatar.png"
|
||||
errcho " $ cat graph.png | imgcat -W 100%"
|
||||
errcho " $ imgcat -p -W 500px -u http://host.tld/path/to/image.jpg -W 80 -f image.png"
|
||||
errcho " $ cat url_list.txt | xargs imgcat -p -W 40 -u"
|
||||
errcho " $ imgcat -t application/json config.json"
|
||||
errcho
|
||||
}
|
||||
|
||||
function check_dependency() {
|
||||
if ! (builtin command -V "$1" >/dev/null 2>&1); then
|
||||
error "missing dependency: can't find $1"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# verify that value is in the image sizing unit format: N / Npx / N% / auto
|
||||
function validate_size_unit() {
|
||||
if [[ ! "$1" =~ ^(:?[0-9]+(:?px|%)?|auto)$ ]]; then
|
||||
error "Invalid image sizing unit - '$1'"
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
## Main
|
||||
|
||||
if [ -t 0 ]; then
|
||||
has_stdin=f
|
||||
else
|
||||
has_stdin=t
|
||||
fi
|
||||
|
||||
# Show help if no arguments and no stdin.
|
||||
if [ $has_stdin = f ] && [ $# -eq 0 ]; then
|
||||
show_help
|
||||
exit
|
||||
fi
|
||||
|
||||
check_dependency base64
|
||||
check_dependency wc
|
||||
file_type=""
|
||||
|
||||
# Look for command line flags.
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-h | --h | --help)
|
||||
show_help
|
||||
exit
|
||||
;;
|
||||
-p | --p | --print)
|
||||
print_filename=1
|
||||
;;
|
||||
-n | --n | --no-print)
|
||||
print_filename=0
|
||||
;;
|
||||
-W | --W | --width)
|
||||
validate_size_unit "$2"
|
||||
width="$2"
|
||||
shift
|
||||
;;
|
||||
-H | --H | --height)
|
||||
validate_size_unit "$2"
|
||||
height="$2"
|
||||
shift
|
||||
;;
|
||||
-r | --r | --preserve-aspect-ratio)
|
||||
preserve_aspect_ratio=1
|
||||
;;
|
||||
-s | --s | --stretch)
|
||||
preserve_aspect_ratio=0
|
||||
;;
|
||||
-f | --f | --file)
|
||||
has_stdin=f
|
||||
is_url=f
|
||||
;;
|
||||
-u | --u | --url)
|
||||
check_dependency curl
|
||||
has_stdin=f
|
||||
is_url=t
|
||||
;;
|
||||
-t | --t | --type)
|
||||
file_type="$2"
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
error "Unknown option flag: $1"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
if [ "$is_url" == "t" ]; then
|
||||
encoded_image=$(curl -fs "$1" | b64_encode) || {
|
||||
error "Could not retrieve image from URL $1, error_code: $?"
|
||||
exit 2
|
||||
}
|
||||
elif [ -r "$1" ]; then
|
||||
encoded_image=$(cat "$1" | b64_encode)
|
||||
else
|
||||
error "imgcat: $1: No such file or directory"
|
||||
exit 2
|
||||
fi
|
||||
has_stdin=f
|
||||
print_image "$1" 1 "$encoded_image" "$print_filename" "$width" "$height" "$preserve_aspect_ratio" "$file_type"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Read and print stdin
|
||||
if [ $has_stdin = t ]; then
|
||||
print_image "" 1 "$(cat | b64_encode)" 0 "$width" "$height" "$preserve_aspect_ratio" "$file_type"
|
||||
fi
|
||||
|
||||
if [ "$has_image_displayed" != "t" ]; then
|
||||
error "No image provided. Check command line options."
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
22
isfolder.sh
Executable file
22
isfolder.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
test_and_copy() {
|
||||
|
||||
if [ -d $1 ] ;
|
||||
then
|
||||
cp -R $1 $2
|
||||
fi
|
||||
}
|
||||
if [ -f $1 ] ;
|
||||
then
|
||||
cp $1 $2
|
||||
fi
|
||||
}
|
||||
|
||||
a=auguste
|
||||
|
||||
folder=$HOME/Documents/2FA
|
||||
dest=$HOME/Desktop
|
||||
|
||||
test_and_copy "$folder" "$dest"
|
||||
|
||||
33
kymsu2.sh
33
kymsu2.sh
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||
echo -e "\033[93m\033[1mkymsu2\033[0m"
|
||||
echo ""
|
||||
echo "Keep Your macOs Stuff Updated 2"
|
||||
echo "a fork from kymsu https://github.com/welcoMattic/kymsu"
|
||||
echo
|
||||
echo "USAGE: kymsu2"
|
||||
echo
|
||||
echo "Commandes: "
|
||||
echo " -h, --help display this help"
|
||||
echo " --nodistract no distract mode (no user interaction)"
|
||||
echo " --cleanup removing any older versions of installed formulae and clearing old downloads from the Homebrew download-cache"
|
||||
echo " --npm_cleanup cleaning npm cache"
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# à renseigner avec le répertoire contenant tes script
|
||||
SCRIPTS_DIR=/Users/bruno/.kymsu/plugins.d
|
||||
|
||||
cd "$SCRIPTS_DIR"
|
||||
|
||||
# On boucle sur tous les fichiers du répertoire…
|
||||
for script in $(find . -name '[_0]*' -maxdepth 1 | sort); do
|
||||
# si le fichier est exécutable…
|
||||
if [ -x "$SCRIPTS_DIR/$script" ]; then
|
||||
# on l’exécute ; le $@ permet de passer à chaque
|
||||
# script les arguments passés à *ce* script
|
||||
$SCRIPTS_DIR/$script $@
|
||||
fi
|
||||
done
|
||||
@@ -1,161 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
<<COMMENT
|
||||
underline=`tput smul`
|
||||
nounderline=`tput rmul`
|
||||
bold=`tput bold`
|
||||
normal=`tput sgr0`
|
||||
echo "toto"
|
||||
|
||||
echo -e "\033[1m bold \033[0m"
|
||||
echo -e "\033[3m italic \033[0m"
|
||||
echo -e "\033[4m underline \033[0m"
|
||||
echo -e "\033[1;3;31m Red bold+italic \033[0m"
|
||||
echo -e "\033[9m strikethrough \033[0m"
|
||||
echo -e "\033[31m Red World \033[0m"
|
||||
echo -e "\033[93m Yellow World \033[0m"
|
||||
echo -e "\033[32m Green World \033[0m"
|
||||
COMMENT
|
||||
|
||||
|
||||
brew=0
|
||||
casks=0
|
||||
mas=0
|
||||
|
||||
function usage {
|
||||
|
||||
cat <<EOM
|
||||
Create Homebrew 's packages and Casks installed list:"
|
||||
a brew-install.sh script is created next to this script..."
|
||||
|
||||
Usage: $(basename "$0") [OPTION]...
|
||||
|
||||
-b brew
|
||||
-c casks
|
||||
-m mas
|
||||
-h display help
|
||||
EOM
|
||||
|
||||
exit 2
|
||||
}
|
||||
|
||||
while getopts ":bcmh-:" option; do
|
||||
|
||||
if [ "$option" = "-" ] ; then
|
||||
case $OPTARG in
|
||||
help) option=h;;
|
||||
brew) option=b;;
|
||||
casks) option=c;;
|
||||
mas) option=m;;
|
||||
*) echo "Option $OPTARG inconnue";;
|
||||
esac
|
||||
fi
|
||||
|
||||
case "$option" in
|
||||
b) brew=1;;
|
||||
c) casks=1;;
|
||||
m) mas=1;;
|
||||
h) usage;;
|
||||
?) echo "Option -$OPTARG inconnue"
|
||||
usage;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
if [ -f brew-install.sh ]; then
|
||||
echo -e "The file \033[93mbrew-install.sh\033[0m already exist! We erase it."
|
||||
rm brew-install.sh
|
||||
fi
|
||||
|
||||
echo '#!/bin/bash' >> brew-install.sh
|
||||
|
||||
# function for installing homebrew
|
||||
echo '
|
||||
installHomebrew() {
|
||||
echo -e "/n Installing Homebrew"
|
||||
#/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
#sudo chown -R $USER /usr/local/
|
||||
#export $PATH=/usr/local/bin:$PATH
|
||||
brew update
|
||||
}' >> brew-install.sh
|
||||
|
||||
|
||||
#if type xcode-select >&- && xpath=$( xcode-select --print-path ) &&
|
||||
# test -d "${xpath}" && test -x "${xpath}" ; then
|
||||
# #... is correctly installed
|
||||
#else
|
||||
# #... isn't correctly installed
|
||||
#fi
|
||||
|
||||
|
||||
# test if CLT is installed
|
||||
echo '
|
||||
# test if CLT is installed' >> brew-install.sh
|
||||
echo '
|
||||
clt=$(xcode-select --install 2>&1 | grep installed)
|
||||
if [ -n "$clt" ]; then
|
||||
echo "Command Line Tools (CLT) for Xcode already installed";
|
||||
else
|
||||
echo "Installing Command Line Tools (CLT) for Xcode";
|
||||
fi' >> brew-install.sh
|
||||
|
||||
# test if homebrew is installed
|
||||
echo '
|
||||
# test if Homebrew is installed' >> brew-install.sh
|
||||
echo '
|
||||
if [[ $(command -v brew) == "" ]]; then
|
||||
installHomebrew
|
||||
else
|
||||
echo "Updating Homebrew"
|
||||
brew update
|
||||
fi
|
||||
' >> brew-install.sh
|
||||
|
||||
# test if mas is installed
|
||||
echo '
|
||||
# test if mas is installed' >> brew-install.sh
|
||||
echo '
|
||||
if [[ $(command -v mas) == "" ]]; then
|
||||
brew install mas
|
||||
else
|
||||
echo "mas already installed"
|
||||
fi
|
||||
' >> brew-install.sh
|
||||
|
||||
if [[ "$brew" -eq 1 ]] || [[ "$casks" -eq 1 ]] || [[ "$mas" -eq 1 ]]; then
|
||||
echo -e "\n# Brew tap list.\n" >> brew-install.sh
|
||||
echo -e "🍺 Get Homebrew \033[3m\033[93mtap\033[0m list"
|
||||
brew tap | sed -e 's/^/brew tap /' >> brew-install.sh
|
||||
fi
|
||||
|
||||
if [ "$brew" -eq 1 ]; then
|
||||
echo -e "\n# Brew packages that I use alot.\n" >> brew-install.sh
|
||||
echo -e "🍺 Get Homebrew \033[3m\033[93mpackages\033[0m installed list"
|
||||
brew list | sed -e 's/^/brew install /' >> brew-install.sh
|
||||
fi
|
||||
|
||||
if [ "$casks" -eq 1 ]; then
|
||||
echo -e "\n# Some casks packages that I like.\n" >> brew-install.sh
|
||||
echo -e "🍺 Get Homebrew \033[3m\033[93mCask\033[0m installed list"
|
||||
brew cask list | sed -e 's/^/brew cask install /' >> brew-install.sh
|
||||
fi
|
||||
|
||||
# https://github.com/mas-cli/mas
|
||||
if [ "$mas" -eq 1 ]; then
|
||||
echo -e "\n# Mac App Store applications list.\n" >> brew-install.sh
|
||||
echo -e "🍏 Get Mac App Store \033[3m\033[93mapplications\033[0m list"
|
||||
#mas list | awk '{print $1}' | sed -e 's/^/mas install /' >> brew-install.sh
|
||||
appfrommas=$(mas list)
|
||||
while read -r line; do
|
||||
number=$(echo "$line" | awk '{print $1}')
|
||||
name=$(echo "$line" | awk -F "(" '{print $1}' | awk {'first = $1; $1=""; print $0'} | sed 's/^ //g')
|
||||
echo "#$name" >> brew-install.sh
|
||||
echo "mas install $number" >> brew-install.sh
|
||||
echo " " >> brew-install.sh
|
||||
done <<< "$appfrommas"
|
||||
fi
|
||||
|
||||
chmod +x brew-install.sh
|
||||
|
||||
terminal-notifier -title 'brew-list' -message 'Packages & casks list created !' -sound 'Glass'
|
||||
33
mkbuild.sh
33
mkbuild.sh
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" == "-h" ]; then
|
||||
echo -e "\\033[93mmkbuild.sh\\033[0m"
|
||||
echo "Build MkDocs project and send him on server"
|
||||
echo
|
||||
echo "USAGE: mkbuild"
|
||||
echo
|
||||
echo " -h display this help"
|
||||
echo
|
||||
exit 0
|
||||
fi
|
||||
|
||||
user="bruno"
|
||||
server="clicclac.synology.me"
|
||||
destination="/volume1/web"
|
||||
local_folder="central_docs"
|
||||
|
||||
cd /Users/bruno/project || exit
|
||||
/usr/local/bin/mkdocs build --clean
|
||||
scp -P42666 -pr ./$local_folder $user@$server:$destination
|
||||
#rsync -avz --stats --progress /Users/bruno/project/central_docs/ $user@$server::$dest
|
||||
|
||||
result=$?
|
||||
|
||||
if [ -x "$(command -v terminal-notifier)" ]; then
|
||||
if [ $result -eq 0 ]; then
|
||||
terminal-notifier -title 'MkDocs' -message "Envoi terminé sur $server !" -sound 'Glass'
|
||||
else
|
||||
terminal-notifier -title 'MkDocs' -message "Echec lors de l'envoi sur $server : erreur $result" -sound 'Basso'
|
||||
fi
|
||||
fi
|
||||
#rsync -rav -e ssh ./central_docs bruno@192.168.1.7:/volume1/web/tt
|
||||
7
modified.sh
Executable file
7
modified.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
dir="/usr/local/etc/httpd"
|
||||
name="httpd.conf"
|
||||
|
||||
test=$(find $dir -name "$name" -mmin -2 -maxdepth 1)
|
||||
#[ ! -z $test ] && echo "$name was modified in the last 2 minutes"
|
||||
[ ! -z $test ] && echo -e "\033[1;31m❗️ ️$name was modified in the last 5 minutes\033[0m"
|
||||
48
openwrt_asus.sh
Executable file
48
openwrt_asus.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
|
||||
usage="USAGE: TL902AC_tftp_recovery.sh <[start | stop]> <complete_path_to_recovery file>"
|
||||
|
||||
# OS/System specific variables
|
||||
tftp_dir=/private/tftpboot/
|
||||
ethport=en1
|
||||
|
||||
# Device specific variables
|
||||
# TP-Link TL-WR902AC v1
|
||||
# https://openwrt.org/toh/tp-link/tl-wr902ac_v1
|
||||
ip_addr=192.168.1.1
|
||||
subnet=255.255.255.0
|
||||
tl_wr902ac_filename=openwrt-23.05.2-bcm53xx-generic-asus_rt-ac88u-squashfs.trx
|
||||
tftp_file_path=$tftp_dir$tl_wr902ac_filename
|
||||
|
||||
# If we are starting the tftp Server
|
||||
if [ $1 = start ]
|
||||
then
|
||||
echo Starting recovery mode...
|
||||
# Check that 2nd argument (recovery image) has been specified (does not validate file)
|
||||
if [ -z $2 ]
|
||||
then
|
||||
echo $usage
|
||||
else
|
||||
echo "Copying file $2 to $tftp_file_path."
|
||||
sudo cp $2 $tftp_file_path
|
||||
echo "Setting ethernet $ethport to $ip_addr $subnet."
|
||||
# Set the ethernet interface to the expected tftp server address
|
||||
sudo ipconfig set $ethport manual $ip_addr $subnet
|
||||
echo "Starting tftp server."
|
||||
# Enable the tftp service
|
||||
sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist
|
||||
fi
|
||||
# If we are stopping the tftp Server
|
||||
elif [ $1 = stop ]
|
||||
then
|
||||
echo Stopping... resuming normal mode
|
||||
# Disable the tftp service
|
||||
sudo launchctl unload -F /System/Library/LaunchDaemons/tftp.plist
|
||||
echo "Deleting file $tftp_file_path"
|
||||
sudo rm $tftp_file_path
|
||||
echo "Setting ethernet $ethport to DHCP"
|
||||
# Set the ethernet interface to back to DHCP for normal operation
|
||||
sudo ipconfig set $ethport dhcp
|
||||
else
|
||||
echo $usage
|
||||
fi
|
||||
53
tabColor.sh
Executable file
53
tabColor.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Texte de l'exemple ( >= 3 caractères ) :
|
||||
TEXT=" Bash " ;
|
||||
|
||||
# Couleur du texte :
|
||||
declare -a FG=('' '1' '4' '5' '7' '30' '31' '32' \
|
||||
'33' '34' '35' '36' '37') ;
|
||||
|
||||
echo
|
||||
|
||||
# Première ligne :
|
||||
printf "FG \ BG\t%${#TEXT}s" ;
|
||||
for bg in {40..47} ; do
|
||||
printf "%${#TEXT}s" "${bg} " ;
|
||||
done
|
||||
echo ;
|
||||
|
||||
# Création du tableau de présentation des combinaisons :
|
||||
for fg in ${!FG[*]} ; do
|
||||
echo -ne "${FG[fg]}\t\033[${FG[fg]}m$TEXT" ;
|
||||
for bg in {40..47} ; do
|
||||
echo -ne "\033[${FG[fg]};${bg}m$TEXT\033[0m" ;
|
||||
done
|
||||
echo ;
|
||||
done
|
||||
|
||||
|
||||
# Comment déclarer une couleur :
|
||||
cat <<_eof_
|
||||
|
||||
Format de déclaration : \\033[XXm où XX prend les valeurs
|
||||
de FG ou BG" ;
|
||||
Retour aux paramètres par défaut : \033[0m" ;
|
||||
Pour plus de détails : http://www.admin-linux.fr/?p=9011
|
||||
|
||||
ST: Style (0 à 9)
|
||||
FG: Foreground (30 à 37)
|
||||
BG: Background (40 à 47)
|
||||
|
||||
\\033[STm (ex Style Bold \\033[1m)
|
||||
\\033[FGm (ex Text Red \\033[31m)
|
||||
\\033[BGm (ex Background Red \\033[41m)
|
||||
|
||||
\\033[FG;BGm (ex Rouge sur fond Vert \\033[31;42m)
|
||||
|
||||
\\033[ST;FGm (ex Jaune souligné \\033[4;33m)
|
||||
|
||||
\\033[ST;FG;BGm (ex Jaune sur fond Bleu souligné \\033[4;33;44m)
|
||||
|
||||
|
||||
|
||||
_eof_
|
||||
50
upgrade_nextcloud.sh
Executable file
50
upgrade_nextcloud.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
host=$(hostname)
|
||||
|
||||
if [ "$host" = "DS916" ]; then
|
||||
|
||||
php_version=73
|
||||
php_bin=/usr/local/bin/php$php_version
|
||||
nc_dir=/volume1/web/nextcloud
|
||||
|
||||
cd $nc_dir || exit
|
||||
|
||||
sudo -u http /usr/local/bin/php74 -d memory_limit=1024M occ maintenance:mode --on
|
||||
sudo -u http /usr/local/bin/php74 -d memory_limit=1024M occ maintenance:repair
|
||||
echo ""
|
||||
echo -e "\033[4mWhen the message 'Should the \"occ upgrade\" command be executed? [Y/n]' is displayed, you must choice 'n' (no)\033[0m"
|
||||
echo ""
|
||||
sudo -u http /usr/local/bin/php74 -d memory_limit=1024M updater/updater.phar
|
||||
|
||||
# Should the "occ upgrade" command be executed? [Y/n] n
|
||||
# non
|
||||
|
||||
echo ""
|
||||
echo -e "\033[4mLa version par défaut de PHP est la 5.6.11, ce qui est insuffisant (7.2 requis). On relance la suite avec la bonne version de php\033[0m"
|
||||
echo ""
|
||||
sudo -u http /usr/local/bin/php74 -d memory_limit=1024M occ maintenance:mode --on
|
||||
sudo -u http /usr/local/bin/php74 -d memory_limit=1024M occ upgrade
|
||||
sudo -u http /usr/local/bin/php74 -d memory_limit=1024M occ maintenance:mode --off
|
||||
|
||||
elif [ "$host" == "localhost" ]; then
|
||||
ip=$(hostname -I | awk '{print $1}')
|
||||
|
||||
if [ "$ip" = "212.227.191.167" ]; then
|
||||
|
||||
php_version=7.3
|
||||
php_bin=/opt/plesk/php/$php_version/bin/php
|
||||
nc_dir=/var/www/vhosts/maboiteverte.fr/httpdocs/nextcloud
|
||||
|
||||
cd $nc_dir || exit
|
||||
|
||||
sudo -u bruno $php_bin occ maintenance:mode --on
|
||||
sudo -u bruno $php_bin occ maintenance:repair
|
||||
sudo -u bruno $php_bin updater/updater.phar
|
||||
|
||||
sudo -u bruno $php_bin occ upgrade
|
||||
sudo -u bruno $php_bin occ maintenance:mode --off
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
33
youtube-api.sh
Executable file
33
youtube-api.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
APIKEY="AIzaSyBtEqykacvWuWiLqq1-eIBZBrJzAYEx_xU"
|
||||
APIURL="https://www.googleapis.com/youtube/v3/search"
|
||||
NORESULTS=25
|
||||
DOWNURL="https://www.youtube.com/watch?v="
|
||||
|
||||
SEARCH="The clash"
|
||||
SEARCH=$(echo $SEARCH | sed 's/ /%20/g')
|
||||
|
||||
QUERY="part=snippet&maxResults=$NORESULTS&q=$SEARCH&type=video&key=$APIKEY"
|
||||
#curl -i -G -d "$QUERY" "$APIURL" | sed '1,15d' | jq '.items[] | .id.videoId, .snippet.title, .snippet.description' > yt.search
|
||||
|
||||
#curl "https://www.googleapis.com/youtube/v3/search?part=snippet&fields=items/snippet(title,description,thumbnails),items/id(videoId)&maxResults=$NORESULTS&q=$SEARCH&type=video&key=$APIKEY" > search_yt.json
|
||||
#cat search_yt.json | jq '.items[] | {"Id": .id.videoId,"Title": .snippet.title,"Description": .snippet.description,"Thumbnail": .snippet.thumbnails.medium.url}'
|
||||
|
||||
|
||||
|
||||
|
||||
# Duration
|
||||
#curl --silent "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet&fields=items/snippet(title,thumbnails),items/contentDetails/duration&key=AIzaSyBtEqykacvWuWiLqq1-eIBZBrJzAYEx_xU&id=l0Q8z1w0KGY"
|
||||
|
||||
#curl --silent "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet&key=AIzaSyBtEqykacvWuWiLqq1-eIBZBrJzAYEx_xU&id=xMaE6toi4mk"
|
||||
|
||||
id="8-cjjzNbg70"
|
||||
|
||||
duration=$(curl --silent "https://www.googleapis.com/youtube/v3/videos?part=contentDetails&fields=items/contentDetails/duration&key=AIzaSyBtEqykacvWuWiLqq1-eIBZBrJzAYEx_xU&id=$id" | jq -r '.items[] | .contentDetails.duration')
|
||||
|
||||
duration=${duration:2}
|
||||
duration=${duration//[HMS]/:}
|
||||
duration=${duration:0:-1}
|
||||
|
||||
echo "$duration"
|
||||
30
youtube.sh
Executable file
30
youtube.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#https://github.com/yt-dlp/yt-dlp#differences-in-default-behavior
|
||||
# https://ytdl-org.github.io/youtube-dl/supportedsites.html
|
||||
|
||||
|
||||
yt_dlp=$HOME/Downloads/yt-dlp_macos # youtube-dl
|
||||
dl_path=$HOME/Downloads
|
||||
|
||||
# https://www.youtube.com/watch?v=lSAHnPU0irM
|
||||
|
||||
# youtube-dl --write-description --write-info-json --write-annotations --write-sub --write-thumbnail URL_DE_LA_VIDEO
|
||||
# youtube-dl -o '%(title)s.f%(format_id)s.%(ext)s' URL_DE_LA_VIDEO --restrict-filenames
|
||||
# youtube-dl -f mp4 URL_DE_LA_VIDEO
|
||||
# youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'
|
||||
|
||||
# --format mp4 -> 22 (1280x720)
|
||||
# -f 22/17/18
|
||||
|
||||
pp=$(pbpaste)
|
||||
|
||||
REGEX="^https://[-[:alnum:]\+&@#/%?=~_|!:,.;]+"
|
||||
if [[ ! $pp =~ $REGEX ]]; then
|
||||
pp="https://www.youtube.com/"
|
||||
fi
|
||||
|
||||
read -e -p "URL of YouTube movie to download: " -i "$pp" url
|
||||
echo
|
||||
|
||||
yt_dlp --format 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' -o '%(title)s.f%(format_id)s.%(ext)s' --paths $dl_path $url
|
||||
Reference in New Issue
Block a user