Lukáš Bařinka
If you're doing something a second time,
you're probably not doing it last time
Pokud něco děláte podruhé,
pravděpodobně to neděláte naposled.
[23/11/2005-08:01:20] core: state process
[23/11/2005-08:01:20] core: I: 0.025 [0.173438] {L:S}
[23/11/2005-08:01:20] core: U: 0.559 [0.290247-0.173492]
[23/11/2005-08:01:20] core: T: 50.09 [1.201045]
[23/11/2005-08:01:20] core: L: 1 [3.870664]
[23/11/2005-08:01:20] core: P: 6.7 [0.008472]
[23/11/2005-08:01:21] core: M: 1 [0.016943]
[23/11/2005-08:01:21] core: heat off (tempH)
[23/11/2005-08:01:21] core: O: 0.386 <0.1.0.0.0.0.1.0>
[23/11/2005-08:01:21] core: state process
[23/11/2005-08:01:21] core: I: 0.025 [0.173551] {L:S}
[23/11/2005-08:01:21] core: U: 0.562 [0.292037-0.173707]
[23/11/2005-08:01:21] core: T: 50.09 [1.201033]
[23/11/2005-08:01:22] core: L: 1 [3.845922]
[23/11/2005-08:01:22] core: heat off (tempH)
[23/11/2005-08:01:22] core: O: 0.386 <0.1.0.0.0.0.0.1>
[23/11/2005-08:01:22] core: state process
[23/11/2005-08:01:22] core: I: 0.025 [0.173553] {L:S}
[23/11/2005-08:01:22] core: U: 0.559 [0.290166-0.173604]
[23/11/2005-08:01:22] core: T: 50.08 [1.201016]
[23/11/2005-08:01:22] core: L: 1 [3.865338]
[23/11/2005-08:01:22] core: heat off (tempH)
[23/11/2005-08:01:22] core: O: 0.386 <0.1.0.0.0.0.1.0>
[23/11/2005-08:01:22] core: state process
[23/11/2005-08:01:23] core: I: 0.025 [0.173529] {L:S}
[23/11/2005-08:01:23] core: U: 0.562 [0.292059-0.173551]
[23/11/2005-08:01:23] core: T: 50.08 [1.201018]
[23/11/2005-08:01:23] core: L: 1 [3.851480]
[23/11/2005-08:01:23] core: heat off (tempH)
[23/11/2005-08:01:23] core: O: 0.386 <0.1.0.0.0.0.0.1>
[23/11/2005-08:01:23] core: state process
[23/11/2005-08:01:24] core: I: 0.025 [0.173516] {L:S}
[23/11/2005-08:01:24] core: U: 0.558 [0.290081-0.173680]
[23/11/2005-08:01:24] core: T: 50.09 [1.201045]
[23/11/2005-08:01:24] core: L: 1 [3.867546]
[23/11/2005-08:01:24] core: heat off (tempH)
[23/11/2005-08:01:24] core: O: 0.386 <0.1.0.0.0.0.1.0>
[23/11/2005-08:01:24] core: state process
[23/11/2005-08:01:24] core: I: 0.025 [0.173526] {L:S}
[23/11/2005-08:01:25] core: U: 0.562 [0.292005-0.173802]
[23/11/2005-08:01:25] core: T: 50.08 [1.200999]
[23/11/2005-08:01:25] core: L: 1 [3.848423]
[23/11/2005-08:01:25] core: heat off (tempH)
[23/11/2005-08:01:25] core: O: 0.386 <0.1.0.0.0.0.0.1>
[23/11/2005-08:01:25] core: state process
[23/11/2005-08:01:25] core: I: 0.025 [0.173534] {L:S}
[23/11/2005-08:01:25] core: U: 0.559 [0.290176-0.172840]
[23/11/2005-08:01:26] core: T: 50.08 [1.201016]
[23/11/2005-08:01:26] core: L: 1 [3.867275]
[23/11/2005-08:01:26] core: heat off (tempH)
[23/11/2005-08:01:26] core: O: 0.386 <0.1.0.0.0.0.1.0>
[23/11/2005-08:01:26] core: state process
[23/11/2005-08:01:26] core: I: 0.025 [0.173419] {L:S}
[23/11/2005-08:01:26] core: U: 0.563 [0.292161-0.173685]
[23/11/2005-08:01:26] core: T: 50.08 [1.200982]
[23/11/2005-08:01:27] core: L: 1 [3.853658]
[23/11/2005-08:01:27] core: heat off (tempH)
[23/11/2005-08:01:27] core: O: 0.386 <0.1.0.0.0.0.0.1>
[23/11/2005-08:01:27] core: state process
[23/11/2005-08:01:27] core: I: 0.025 [0.173394] {L:S}
[23/11/2005-08:01:27] core: U: 0.559 [0.290337-0.173639]
[23/11/2005-08:01:27] core: T: 50.08 [1.200987]
[23/11/2005-08:01:28] core: L: 1 [3.870080]
[23/11/2005-08:01:28] core: heat off (tempH)
[23/11/2005-08:01:28] core: O: 0.386 <0.1.0.0.0.0.1.0>
To make a graph animation of input data.
Animace dat vynesených do grafu.
ffmpeg
- ffmpeg video converter Converts images into video fileffmpeg
- ffmpeg video converter Převede obrázky do video souborugnuplot
- an interactive plotting program Plots data (values) into imagegnuplot
- an interactive plotting program Vykreslí data (hodnoty) do obrázkůawk
- data generator Or real data + filtersawk
- data generator Nebo skutečná data + filtry
#!/usr/bin/awk -f
BEGIN {
a = 100
srand()
for ( i = 1; i < 1000; i++ ) {
a += rand() - 0.5
print a
}
}
gnuplot
set terminal png
set output "out.png"
set xrange [0:1000]
set yrange [95:105]
plot "-" with lines t ""
#!/bin/bash
# Graph animation of input data
# Usage: $0 data
# Prepare separate slides
#FIXME
# Join slides into animation
#FIXME
#!/bin/bash
# Graph animation of input data
# Usage: $0 data
# Prepare separate frames
# For each frame
# Prepare data
#FIXME
# Run gnuplot to make single frame
#FIXME
# Rename frame according to frame #
#FIXME
# Join frames into animation
#FIXME
# Cleanup
#FIXME
# Prepare separate frames
# For each frame
for (( i=1; i<=1000; i++ )); do
# Run gnuplot to make single frame
(
# Prepare data
cat script.gp
head -n "$i" data
) | gnuplot
# Rename frame according to frame #
mv out.png $( printf "%03d" "$i" ).png
done
# Prepare separate frames
# For each frame
for (( i=1; i<=900; i++ )); do
# Run gnuplot to make single frame (use part of data)
echo "set terminal png;
set output '$( printf %03d $i ).png';
set format x '';
plot [0:100][95:105] \
'<sed -n $i,$((100+i))p data' \
with boxes t'$i-$((100+i))';
" | gnuplot
done
# Join frames into animation
ffmpeg -i %03d.png anim.mp4
#Cleanup
rm *.png
find . -maxdepth 1 -name '*.png' -delete
; do
and ; then
on the same line aswhile
, for
or if
.case
by 2 spaces."${var}"
over "$var"
.readonly
or declare -r
for constants. Constants and anything exported to the env. should be capitalized.$?
, $#
, $$
, $!
Prefer quoting of “named” internal integer variables (PPID
) for consistency.[[ … ]]
."$@"
unless you have a specific reason to use $*
such as simply appending the arguments to a string in a message or log.[[ … ]]
is preferred over [ … ]
, test
and /usr/bin/[
.-z
or -n
.==
for equality rather than =
.<
and >
in [[ … ]]
which performs a lexicographical comparison. Use (( … ))
or -lt
and -gt
for numerical comparison.(( … ))
or $(( … ))
rather than let
or $[ … ]
or expr
.(( … ))
as a standalone statement, and otherwise be wary of its expression evaluating to zero.$(command)
instead of `command`
.-
, it’s a lot safer to expand wildcards with ./*
instead of *
.eval
should be avoided.stderr
.local
. Declaration and assignment should be on different lines.main "$@"
#!/usr/bin/awk -f
BEGIN {
v = 100
t = systime()
srand()
for ( i = 1; i < 1000; i++ ) {
v += rand() - 0.5
T = strftime( "[%Y-%m-%d %T]", t+i )
print T, v
}
}
set terminal png
set output "out.png"
set xdata time
set timefmt "[%Y-%d-%m %H:%M:%S]"
set xtics format "%H:%M"
set xrange ["[2021-03-29 07:23:37]":"[2021-03-29 07:40:15]"]
set yrange [95:105]
plot "-" using 1:3 with lines t ""
Comments
stdout
orstderr
.TODO
comments for code that is temporary, a short-term solution, or good-enough but not perfect.