Fichier coco
en entrée :
123 2
234 2
123 1
456 1
234 1
Pour trier sur la première colonne sans changer l'ordre par rapport au reste de la ligne :
a = { | |
x = 64, | |
y = 44 | |
} | |
b = { | |
x = 34, | |
y = 64 | |
} |
GAMEPAD 1 | |
GLOBAL K | |
GLOBAL Z | |
Z = 1 | |
INC=0.1 | |
N=2 | |
GLOBAL H | |
H=87 |
-- PICO-8 code | |
local lookup = '0123456789abcdef' | |
local values = '' | |
for i =1,16 do | |
for j = 1,16 do | |
local num = 1+((i+j-2)%0x10) | |
values = values .. sub(lookup,num,num) | |
end |
-- PICO-8 code | |
function draw_rotating_bobs() | |
for i=0,15 do | |
local x=63+40*cos(t()/4+i/16) | |
local y=63+40*cos(t()/8+i/16) | |
spr(1,x,y) | |
end | |
end |
Fichier coco
en entrée :
123 2
234 2
123 1
456 1
234 1
Pour trier sur la première colonne sans changer l'ordre par rapport au reste de la ligne :
Voir aussi : http://www.grymoire.com/Unix/Awk.html
awk '{ if($2=="POST") { dot="."} else { dot="X" } if ($1 != ass) { print ass, dots; ass=$1; dots=""; } else { dots=dots""dot; } } END { print ass, dots }'
Pour agréger des lignes comme ça
451776 PATCH
451776 PATCH
456559 PATCH
456559 PATCH
xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr] [-L number] [-n number [-x]] [-P maxprocs] [-s size] [utility [argument ...]]
La commande xargs
ne va pas s'exécuter ligne par ligne, mais elle va regrouper les lignes qu'elle reçoit pour les passer à la commande.
$ find /bin -xdev -print0 | xargs -0 -t -n 10 -P4 true 2>&1 | less
true /bin /bin/cat /bin/echo /bin/launchctl /bin/df /bin/pwd /bin/test /bin/csh /bin/wait4path /bin/unlink
true /bin/sleep /bin/stty /bin/date /bin/ed /bin/expr /bin/pax /bin/bash /bin/kill /bin/sh /bin/ps
true /bin/link /bin/tcsh /bin/dd /bin/mkdir /bin/ksh /bin/hostname /bin/rmdir /bin/mv /bin/ln /bin/ls
true /bin/cp /bin/sync /bin/zsh /bin/chmod /bin/rm /bin/[
Voir si le fichier commence par une signature connue :
Sinon, pour avoir les images, j'ai jeté un oeil avec xxd, trouvé des données après 2000 octets, et vu un pattern un octet sur deux. Pour info, mon couteau suisse pour l'analyse rapide à la grosse louche des octets impairs :
$ xxd -s 2000 -b 2019\ 01\ 10\ 15H\ 56M.raw | cut -d ' ' -f 2,4,6 | tr ' ' '\n' | sort | uniq -c
Si on regarde les données à partir de l'octet 0x7d0, on voit un entre-laçage d'octets dans les deux fichiers. Les octets impairs ne prennent que 10 valeurs possibles comprises entre 0x09 (0b00001001) et 0x12 (0b00010010).
Wait for an http service with wget
:
wget --retry-connrefused -T 60 -O- http://localhost:4200
Wait for a port to listen, http or other with netcat
:
for i in `seq 60`
do
nc -z localhost 5432 && echo Success && exit 0
echo -n .