emptygif
Idioma: Português

Todas as linguagens e frameworks

printf (Bash, zsh) Shell

Um snippet em Shell para printf (Bash, zsh) que responde às requisições para /pixel.gif com o GIF vazio, decodificado uma única vez na inicialização.

printf (Bash, zsh) Shell

Arquivo
pixel.sh
# %b expands the \xHH escapes (bash and zsh builtins; POSIX sh lacks \x - use base64 -d).
printf '%b' '\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff\x00\x00\x00\x21\xf9\x04\x01\x00\x00\x00\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3b' > pixel.gif

Executamos este snippet e comparamos os bytes que ele retornou.

Site oficial: printf (Bash, zsh)

Mais em Shell