Skip to content
  • Benjamin Otte's avatar
    gtk-demo: Update listbox example with longer list · df5ee78c
    Benjamin Otte authored
    Add all 388 tweets of the @GTKtoolkit account. This shows the
    performance behavior of the listbox (not good with that many rows) and
    allows us to quickly notice when things get worse (or better).
    
    And just so I have a place where I can dump how I generated this file:
    
    First, I got Timm Bäder to download me the json for the twitter feed
    into a file gtk.json, then I ran the jq tool on it like this:
    
    jq ".[] | if .retweeted_status then .retweeted_status.user.name + \"|\"
    + .retweeted_status.user.screen_name else .user.name + \"|\" +
    .user.screen_name end + \"|\" + .text" gtk.json | cat -n | sed
    "s/\\s*\([0-9]*\)\t\"\(.*\)\"/\\1|\\2/" > messages.start
    
    jq ".[] | .created_at" gtk.json | sed "s/\"\(.*\)\"/\1/" | while read
    in; do date +%s -d "$in"; done > dates
    
    jq ".[] | \"0|\" + if .retweeted_status then .user.screen_name else \"\"
    end + \"|\" + (.favorite_count | tostring) + \"|\" + (.retweet_count |
    tostring)" gtk.json | sed "s/\"\(.*\)\"/\\1/" > messages.end
    
    paste -d\| messages.start dates messages.end > messages.txt
    
    This whole machinery of going through 3 intermediate files was only
    necessary to onvert the dates from ISO format to unix timestamps,
    otherwise this could have been a single line.
    df5ee78c