Lev Serebryakov (blacklion) wrote,
Lev Serebryakov
blacklion

идиотского хвастовства псто - вот такое я нашёл в стареньком скрипте на сервере

eval `echo "SELECT value FROM aggregates WHERE name = '$AGG1' OR name = '$AGG2'" | \
    /usr/local/bin/mysql -p${PASS} -u $USER $DB | \
    tail -2 | \
    ( read CNT1; read CNT2; echo CNT1="${CNT1}"; echo CNT2="${CNT2}" )`
echo "
% Def string
/STR (${CNT1}/${CNT2}) def
% (XX) -> 0..1
/MakeOneColor {
 /C 5 string def
 C 0 (16#) putinterval
 C exch 3 exch putinterval
 C cvi 255.0 div
} bind def
% Def color from string /string/ MakeColor /num/ /num/ /num/
/MakeColor {
 dup 0 2 getinterval MakeOneColor exch
 dup 2 2 getinterval MakeOneColor exch
 dup 4 2 getinterval MakeOneColor exch
 pop
} bind def
% Select font
/${FONT} findfont ${SIZE} scalefont setfont
% Calculate size of image
0 0 moveto STR false charpath pathbbox
/Y2 exch def /X2 exch def /Y1 exch def /X1 exch def
X2 2 add /W exch def
Y2 2 add /H exch def
% Set page size
« /PageSize [ W H ] » setpagedevice
% Make background
(${BKCOLOR}) MakeColor setrgbcolor
0 0 W H rectfill
% Make text
(${FNCOLOR}) MakeColor setrgbcolor
1 1 moveto STR show
% All done!
showpage
" | /usr/local/bin/gs -dNOPAUSE -q -sDEVICE=png16m -dBATCH -r${RES}x${RES} -dTextAlphaBits=4 -sOutputFile=${BASE}/data/counter.png -
Subscribe
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 12 comments