Processing math: 100%

Wiki

A universe of ideas

User Tools

Site Tools


computer:bash_snippets

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
computer:bash_snippets [2017-12-20 05:22] – ↷ Page moved from bash_snippets to computer:bash_snippets skrupelloscomputer:bash_snippets [2020-11-18 18:11] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Bash snippets ====== ====== Bash snippets ======
 http://www.commandlinefu.com http://www.commandlinefu.com
 +
 +===== Git =====
 +<code bash>
 +git checkout  -b test5 && git rebase --autosquash --interactive  --root test5
 +</code>
 +===== Play YouTube Playlists =====
 +<code bash>
 +youtube-dl \
 +    -f 'bestvideo[vcodec=vp9]+bestaudio[acodec=opus]' \
 +    --merge-output-format mkv \
 +    -o 'id_%(playlist_index)s - %(title)s (%(id)s).%(ext)s' \
 +    --playlist-start 1 \
 +    --playlist-end 19 \
 +    'https://youtube.com/playlist/url'
 +mkvmerge -o all_001-019.mkv id1..19 
 +mpv --save-position-on-quit all_001-019.mkv
 +</code>
 +
 +<WRAP center round important 60%>
 +  * Achte auf ''['' und '']'' um die input Videos im //append// Modus zu mergen
 +  * Der glob ''*'' sortiert nicht numerisch (aber ''*(n)'' geht auch)
 +</WRAP>
 +
 +
 +Geeignete Formate finden:
 +<code bash>
 +youtube-dl -F 'https://youtube.com/playlist/url' | \
 +grep -E '^[0-9]+' | \
 +sort -nr | \
 +uniq -w 10 -c | \
 +sort -nrs
 +</code>
 +
 +<WRAP center round important 60%>
 +Achte auf die Hardware-Beschleunigung (siehe ''vainfo'')
 +</WRAP>
  
 ===== Order files and directories recursive by date ===== ===== Order files and directories recursive by date =====
Line 113: Line 149:
 </code> </code>
  
-===== Network monitoring ===== 
-http://www.binarytides.com/linux-commands-monitor-network/ 
  
-^ Programm ^ Per Interface ^ Per Stream ^ Per Process ^ Non Root ^ Kommentar ^ 
-| ''iptraf-ng'' | (V) | (V) | (X) | (X) | GUI | 
-| ''nmon''      | (V) | (X) | (X) |     | Nicht seine hauptaufgabe | 
-| ''iftop''     | 
-| ''tcptrack''     | 
-| ''nethogs''   | (X) | (X) | (V) | (X) | Zeigt nur neue Verbindungen | 
-| ''pktstat''   | (V) | (V) | (X) | (X) | (''-T'' für pro Interface) 
-| ''bmon''      | (V) | (X) | (X) | (V) | Wie nload, nur ohne farbe und ohne verständlich, aber mit mehr details | 
-| ''slurm''     | (V) | (X) | (X) | (V) | Wie nload, nur mit farbe und ohne verständlich | 
-| ''nload''     | (V) | (X) | (X) | (V) | Es ist klar ob Bit oder Byte, wie slurm | 
- 
- 
-  * ''ngrep   -d eth0 -x     port 80'' 
-  * ''tcpflow -i eth0 -C -e  port 80'' 
- 
-Iperf server: http://ping.online.net/ 
 ===== diff & patch ===== ===== diff & patch =====
   * ''diff -u original.c new.c > original.patch''   * ''diff -u original.c new.c > original.patch''
Line 199: Line 217:
 </FileSpec> </FileSpec>
 </code> </code>
 +
 +====== CUPS ======
 +Delete all learned Network printers:
 +<code bash>
 +lpstat -s | \grep ///dev/null | cut -c 12- | cut -d: -f1 | xargs -n1 -- lpadmin -x 
 +</code>
 +
 ====== Zu schlecht für ein dotfile ====== ====== Zu schlecht für ein dotfile ======
 Hier sind scripte, die zwar eine nette Idee, aber viel zu schlecht für ein dotfile sind. Hier sind scripte, die zwar eine nette Idee, aber viel zu schlecht für ein dotfile sind.
Line 235: Line 260:
 </code> </code>
  
 +<code>
 +smartctl -x /dev/sda
 +</code>
  
  
 +<code python>
 +for i in [2, 1.9, 1.5, 1.1, None, 0, None, -1.1, -1.5, -1.9, -2]:
 +    print('-'*105 if i is None else f'{i: .1f}: ceil = {math.ceil(i): } || round = {round(i): } | int(i+.5) = {int(i+0.5): } || floor = {math.floor(i): } | int = {int(i): } || int(i)+1 = {int(i)+1: } | int(i)-1 = {int(i)-1: }')
 +</code>
 +<code>
 + 2.0: ceil =  2 || round =  2 | int(i+.5) =  2 || floor =  2 | int =  2 || int(i)+1 =  3 | int(i)-1 =  1
 + 1.9: ceil =  2 || round =  2 | int(i+.5) =  2 || floor =  1 | int =  1 || int(i)+1 =  2 | int(i)-1 =  0
 + 1.5: ceil =  2 || round =  2 | int(i+.5) =  2 || floor =  1 | int =  1 || int(i)+1 =  2 | int(i)-1 =  0
 + 1.1: ceil =  2 || round =  1 | int(i+.5) =  1 || floor =  1 | int =  1 || int(i)+1 =  2 | int(i)-1 =  0
 +---------------------------------------------------------------------------------------------------------
 + 0.0: ceil =  0 || round =  0 | int(i+.5) =  0 || floor =  0 | int =  0 || int(i)+1 =  1 | int(i)-1 = -1
 +---------------------------------------------------------------------------------------------------------
 +-1.1: ceil = -1 || round = -1 | int(i+.5) =  0 || floor = -2 | int = -1 || int(i)+1 =  0 | int(i)-1 = -2
 +-1.5: ceil = -1 || round = -2 | int(i+.5) = -1 || floor = -2 | int = -1 || int(i)+1 =  0 | int(i)-1 = -2
 +-1.9: ceil = -1 || round = -2 | int(i+.5) = -1 || floor = -2 | int = -1 || int(i)+1 =  0 | int(i)-1 = -2
 +-2.0: ceil = -2 || round = -2 | int(i+.5) = -1 || floor = -2 | int = -2 || int(i)+1 = -1 | int(i)-1 = -3
 +</code>
computer/bash_snippets.1513743736.txt.gz · Last modified: 2020-11-18 18:10 (external edit)