Jump to content

pyed

Member
  • Posts

    4
  • Joined

  • Last visited

Posts posted by pyed

  1. sure I tested the script outside Alfred and it perfumed well.

     

    If you've got the time, you can test it yourself

     

    - save http://sprunge.us/fKCc to `~/log`

    - install my workflow: https://cloudup.com/cwu5Q2bcrFw

     

    then try to look for some names e.g. "have bart"

    then try to look for a name that doesn't exist and see how much time it takes e.g. "have reta"

     

    if you wanna test that script outside alfred, save http://sprunge.us/dKLH, run it e.g. $ bash script bart

  2. I just upgraded to Alfred 3, and I noticed that one of my old workflows works very slowly, it used to work just fine with Alfred 2

     

    this workflow is just a bash script that takes a `{query}` and do a grep on a large log and display the output, I wrote it ~3 years ago and it is poorly written, I probably can re-write it and make it fast, but I'm hoping that it'll help you guys catch a bug with Alfred 3.

    # 
    #
    
    name={query}
    
    # will cat my log then i'll grep the $name;
    # case insensitive with '-i' then i'll pass it to awk and print the title;
    # then i'll pass to 'tr' to delete spaces "strip", then pass it again to 'tr';
    # to replace new lines with spaces and save all that in var called result
    result=`cat ~/log | grep -i $name | awk -F'|' '{print $7}' | tr -d ' ' | tr '\n' ' '`
    
    # this variable will hold a long xml string that will be returned;
    # I started with the end of it, because I'll reverse it in the end of the script;
    # the reason I'm reversing it, to get the latest titles first;
    
    xml='
    </items>
    '
    # this loop go through every title in result and attach the proper xml tags to the var xml
    for line in $result; do
    xml=$xml"
      </item>
        <icon>icon.png</icon>
        <subtitle>$line</subtitle>
        <title>$line</title>
      <item uid=\"\" arg=\"none\" valid=\"no\" autocomplete=\"\">
    "
    done
    
    # this is the head of xml 
    xml=$xml'
    <items>
    <?xml version="1.0"?>
    '
    # this line here will flip the whole xml string.
    xml=`echo "$xml" | sed '1!G;h;$!d'`
    
    
    # print it in alfred window.
    cat << EOB
    $xml
    EOB
    

    the `~/log` file contains lines like:

    |28-08-2016| |16:34 | |276766658   |  BillyBoy
    |28-08-2016| |17:13 | |69352274    |  Goat
    |29-08-2016| |13:52 | |868973148   |  Foobar
    |30-08-2016| |04:49 | |72410542    |  HeyThere
    |30-08-2016| |04:55 | |169608384   |  TheFirst
    
  3. my problem is that I need to right click on some links and copy them, I can't CMD+CC on the link to merge them, and right clicking and copying twice won't trigger the merge behaviour.

    is there a way that I can merge those URLs ? or maybe after copying a bunch of them I can merge my whole current Clipboard history and paste it at once ?

×
×
  • Create New...