Happy Hanukkah


– lightning up the Menorah (1’st candle was today)
– cat is acting funny

– at first I’m..
– but then I’ve quickly grabbed the phone and started to film..

– breaking video to frames, one per new PNG file, using

convert -coalesce video.mpeg out%05d.png

– adding watermark to the bottom of each PNG file, using

convert out00000.png -background #685067 -fill white -background #6C938E -pointsize 12 label:"i c o m p i l e . e l a d k a r a k o . c o m" -gravity Center -append anno_label2.jpg

making a quick and dirty parallel-multi-process batch file (using “start”)
to make it faster/better/cool’er


@echo off

set sFILE_NAME_INPUT="%~s1"

set sFILE_NAME_OUTPUT=%~d1%~p1
set sFILE_NAME_OUTPUT=%sFILE_NAME_OUTPUT%_watermark_%~n1
::use JPG ext.

call convert %sFILE_NAME_INPUT% -background #685067 -fill white -background #6C938E -pointsize 12 label:"i c o m p i l e . e l a d k a r a k o . c o m" -gravity Center -append "%sFILE_NAME_OUTPUT%"



@echo off
echo I am the runner

for %%e in (*.png) do (
    ::parallel different process. and continue.
    start /low /min "cmd /c "call _file_encoder.cmd "%%e"""

– double click the _start_all.cmd, 1 second operation x99 files (in parallel) takes about 10 seconds.

– making a 6-seconds delay, HD animated GIF, using:

convert -background white -alpha remove -layers OptimizePlus -delay 6 *.jpg -loop 0 animation.gif

– thinking 2-way gif will be wayyyy funnier, making the gif go back and forth, using:

convert animation.gif -coalesce -duplicate 1,-2-1 -layers OptimizePlus -loop 0 animation_bf.gif

result is a super HD, but single gif> 22MB,
copy every 2nd image to another folder, cut 1/2 of the frames (some things do not need a script…)

– quickly writing this post with all those convert tricks,
clicking publish, and laugh my ass out for 4 minutes no b$hit :)

Going with the holiday spirit and watching some “Robot Chicken” Hanukkah sketches:

Happy Holidays

Robot-Chicken Bipolar Bear (and a JavaScript Download-Video Trick For adultswim Host-Website)



  • The escaped animal is a polar bear with the ability to survive in the Arctic and Antarctic.
  • It exhibits massive mood swings like that of a manic-depressive,
  • and has equal sexual desires for both males and females.

Army Guy:

  • Dear god, are you suggesting what I think you’re suggesting?


  • That’s right.. –
  • A bi-polar, bipolar, – bi polar bear.

Army Guy:

  • That is very stupid..

Robot Chicken (by adultswim.com) is a sketch-like comedy TV-show made with action-figures using stop-motion and a funny voice-over, usually filled with pun-games, which are the type of comedy that make me laugh the most :))

Original website is http://www.adultswim.com/videos/robot-chicken/bipolar-bear

and running the following code, will add a download button,
it just uses the video-url from the page’s internal-source code, and isn’t decrypting or breaking stuff or anything.. its publicly accessible (just don’t use it in any evil doing sort..)

(function(window,document, info){
  "use strict";

    window.setTimeout(function(){     //execute a non-blocker

      info.link.href = info.vid_href;
      info.link.download = info.vid_downloadfilename;
      info.link.title = info.link.title
                          .replace("##TITLE_FULL##", info.vid_title_full)
                          .replace("##VID_TYPE##", info.vid_type)
                          .replace("##VID_DURATION##", (~~info.vid_duration))

      info.placement.insertBefore(info.link, info.placement.firstElementChild);

    }, 200);

  }(window,document, {"_":""
    ,'placement':             document.querySelector("#video-player-object-wrapper")
    ,'placement_first':       document.querySelector("#video-player-object-wrapper").firstElementChild
    ,'link':                  (function(){
                                 var a       = document.createElement('a');
                                 a.target    = "_self";
                                 a.rel       = "nofollow";
                                 a.className = "download_button";
                                 a.title     = "Click To Download \"##TITLE_FULL##\" (##VID_TYPE##: ##VID_DURATION## Seconds)";
                                 return a;
    ,'style':                  (function(){
                                 var s  = document.createElement('style');
                                 s.type = "text/css";
                                 '.download_button{background-color:rgba(255,183,57,.8);border:3px solid rgba(255,183,57,.3);border-radius:10px;box-shadow:2px 2px 2px rgba(255,255,255,.3);cursor:pointer;display:block;height:30px;height:100% !important;margin:0px 0px 10px 0px;max-width:100px;outline:1px rgba(255,255,255,.3);text-align:center;transition:all .3s ease-in-out;-webkit-font-smoothing:subpixel-antialiased;}'
                               + '.download_button:hover{background-color:rgba(255,237,142,.8);border:3px solid rgba(255,237,142,.3);}'
                                 document.getElementsByTagName("body")[0].appendChild(s); //already add this to the document (parsed into stylesheet)
                                 return s; //unneeded..
    ,'vid_href':              bootstrappedData.slugged_video.segments[0].assets[0].url
    ,'vid_downloadfilename':  encodeURI((bootstrappedData.slugged_video.collection_title + " - " + bootstrappedData.slugged_video.title + " - " + bootstrappedData.slugged_video.description).replace("\n","").replace("\r","").replace(".","")) + ".flv"
    ,'vid_title_full':        (bootstrappedData.slugged_video.collection_title + " - " + bootstrappedData.slugged_video.title + " - " + bootstrappedData.slugged_video.description).replace("\n","").replace("\r","").replace(".","")
    ,'vid_duration':          bootstrappedData.slugged_video.segments[0].assets[0].duration
    ,'vid_type':              bootstrappedData.slugged_video.segments[0].assets[0].mime_type

q: what is so interesting about this code ?
a: well..

  • while the main logic is in the “big” anonymous method,
  • most of the minor work preparing the elements, or data, is done before the main-method executes,
  • kept to the minimal, the memory used is quickly disposed once its logically unneeded.
  • code uses a unique technique I’ve made and refined over the time, of not using var statements overall in the main method (pre-preparing..).
  • another concept is avoiding moving a long-list of arguments to the method, and using a data-structure such as json-like object to pass a static-data, variables, etc.. where they order is not important,
  • this way maintenance is easy adding, or removing “”arguments””- does not required “Function Signature (a.k.a Header) Change – Function looks the same.
  • 2014-11-01_183051