Jump to content


  • Posts

  • Joined

  • Last visited

Contact Methods

  • Twitter
  • Website URL

Profile Information

  • Location

_oho's Achievements


Member (4/5)



  1. )) Ok, crossing my hands on my back, looking at the ground and blushing ... I have to admit that it was the fastest route based on what google gave me first. I'm a poor marketing guy ;( Your rock, it's even better! In particularly because I needed to get rid of standard output that prevented generating feedback on Alfred ... I then could easily add stdout= on the subprocess.call: FNULL = open(os.devnull, 'w') retcode = subprocess.call(['sips', '-s', 'format', 'png', 'out.jpg', '--out', 'out.png'], stdout=FNULL, stderr=subprocess.STDOUT) I was fighting using my command line to find a way with os.system to get rid of it, but to be honest it was a nightmare . Not even sure I could have succeed ... Thanx again. I love Alfred and Alfred community ... _oho
  2. Thanks guys for putting me on the right track (and pushing me not to be too lazy). There is indeed a way to manage it from command line without having to setup painful image management lib dependencies (like PIL in python - for instance). I have just verified that the following command line from python does the trick (convert a base64 bit encoded jpeg data text to a local png file): os.system("echo " + data + " | perl -MMIME::Base64 -ne 'print decode_base64($_)' > out.jpeg && sips -s format png out.jpeg --out out.png") supposing that you have: import os and data is something like: data = b'''/9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcg SlBFRyB2NjIpLCBxdWFsaXR5ID0gNzUK/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0a Hx4dGhwcICQuJyAiLCMcHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIy MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgAeABk AwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMF ... Vo1IOPeiin1EDDc5x24rT0uUJMschwrHg+hoorGezNINpqx1SOxijUMxAOHJwM8nH6VqRQRMSQoV cD60UVmjtjsJf3aWFo8q8ADgY6n0rgb65mvbh5pmLMepJoorSOxz1pMqxtty2BhefrVOe+luMj7i nsKKKt7HOQBBjpRRRUAf/9k=''' Without doing it from Python, it would be from simple command line something like: perl -MMIME::Base64 -ne 'print decode_base64($_)' < base64dataJPEG.txt > image.jpeg && sips -s format png image.jpeg --out image.png _oho
  3. Hum..., cool I didn't know sips at all! And it look really handful and simple as from command line. Thank for the tip. This said, in my very particular case, the original image is a 64bits encoded jpeg data text. Quickly looking at sips, I don't see any way to use as input a base64 image. Can we ? Could it be that I have missed something ? O.
  4. Thank! I'll have a look, it's still possible that I did something too complicated, but I couldn't find on Python an easy way to convert base64 jpeg to png file. For info only (might be useful for others) I did something like : def Base64ToPng(base64DataTxt,filename,destination_path): import base64 import re from PIL import Image from io import BytesIO base64JustDataTxt = re.sub(r'data\:image\/jpeg;base64, ', "", base64DataTxt) #logging.error('base64JustDataTxt:\n' + base64JustDataTxt) im = Image.open(BytesIO(base64.b64decode(base64JustDataTxt))) im.save(destination_path + '/' + filename + '.png', 'PNG') return destination_path + '/' + filename + '.png' Then I needed here PIL in particular (that was not that easy to install). I'm currently porting my backend process to local python process within Alfred. Almost done ... Once done, I'll double check to see if I can make it without extra dependencies ... O.
  5. Thank you for your note RodgerWW. Yes, I believe I will not have much other choices than do the conversion locally. Actually I wanted to avoid too much dependencies from local side and provide from backend all the content needed to display my result from the workflow without need of some kind of local processing. I have just did convert from backend side my base64 jpeg image to a base64 png image hoping that Alfred would accept a base64 image if it were png. I believe there are no other options to provide with a local png as file only (in top of application icon option) - right ? I will then now work on do the conversion locally from Alfred Workflow. Unfortunately I don't think I will succeed in doing this without need of dependencies like libjpeg, libpng and other Python stuff like PIL/Pillow or some kind of PHP ImageMagic ... ;( _oho
  6. Hello, I can't find in the forum anything similar to my bellow question, so I hope this is not a yet again asked question ... I was trying to set 64bit encoded data image at the place of an image name in Workflow result display, but this does not work. Is there a was to do it or it's just not possible at all yet ? Example: <items> <item uid="123456" arg="http://google.com" valid="YES"> <title>My row title</title> <subtitle>some kind of subtitle</subtitle> <icon type="filetype"> data:image/jpeg;base64, /9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4wICh1c2luZyBJSkcg SlBFRyB2NjIpLCBxdWFsaXR5ID0gNzUK/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0a Hx4dGhwcICQuJyAiLCMcHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIy MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgAeABk AwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMF ... Vo1IOPeiin1EDDc5x24rT0uUJMschwrHg+hoorGezNINpqx1SOxijUMxAOHJwM8nH6VqRQRMSQoV cD60UVmjtjsJf3aWFo8q8ADgY6n0rgb65mvbh5pmLMepJoorSOxz1pMqxtty2BhefrVOe+luMj7i nsKKKt7HOQBBjpRRRUAf/9k= </icon> </item> </items> If this is not possible, does someone see a possible workaround if my image sources are 64encoded data ? Olivier.
  7. "contact list result" is the keyword used to call newt script filter that just do in bash: cat << INFO `more /tmp/ldap-result.xml` INFO Meaning that your /tmp/ldap-result.xml should not exist or be not well formed. Try to see if you have a /tmp/ldap-result.xml. Also, my parsing is expected a specific type of info from your ldapsearch result. if the result is different, it will not work. O.
  8. Hello Chris, I don't know if you have already solved your problem? Sorry for late reply, I'm on vacation and as commonly stated, "with limited email access" Looking at the python script, what you probably want to set first is your ldap host. So first line to change is line 4: LDAP_HOST="". In my cas it's something like LDAP_HOST="ldap://myCompanyInterlaHost.internalDomain" Next step is to find out the options (in red) to set in line 24. ldap_result=Popen(["ldapsearch", "-S", "displayName", "-x", "-b", "dc=localInfoToChange,dc=fr", "-H", LDAP_HOST, "-LLL", "(displayName="+KEYWORD+"*)", "telephoneNumber", "mail", "uid", "displayName], stdout=PIPE, stderr=devnull).communicate()[0] Note: blue strings are the fields I'm querying at while running ldapsearch command. Finally, I'm doing some parsing of returned text from ldapsearch command. In my case, I'm looking to extract "telephoneNumber", "displayName", "uid", and "mail". In a loop while I find results I write to a file the content, correctly formatted for Alfted listing info. Sorry, as I'm not at the office, I cannot show what looks like the result of ldapsearch. What I would suggest is to start by identifying your ldap server url then play around with ldapsearch command line from within terminal and see if you can get some results based on your search. The rest will be playing with parsing your own results. Good luck. O.
  9. Hello, very nice workflow. I found issues while using it (did not work at first place). After investigation I found that: 1) I did not set first the option to "Enable access for assistive devices and applications" (see: http://support.apple.com/kb/HT6026). Without this, the workflow does not work. 2) my language is in French and it did not work unless I set "deviceselected" as «class utf8» as follow: set deviceselected to the value of text field 1 of row i of table 1 of scroll area 1 of tab group 1 of window 1 as «class utf8» Indeed, my headphone is named: "écouteur" ... I wanted to do a pull request, but it's looks like the GitHub code is not updated. is it ? Otherwise, any idea why when my headphone is plugged I don't see in the list of output my local speaker (named Haut-parleurs internes in French)? I would love to be able to switch between local speakers and headphone without need to unplug my local headphone. That would be my main usage after send it through AirPlay ... And it's the all point of the workflow ... Olivier.
  10. [version 1.1 on GitHub does fix a regression that prevented multiple image selection] Hello, I have a Macbook pro retina. And every time I need to share a screenshot with friends or co-workers, I have to resize them as this screenshots will just be too big to be shared on their original size. Then I wrote this quick and dirty workflow that does resize you images selection while choosing your preferred percentage. Personally I usually use 40% ... When I say quick and dirty, it's because I use a build-in automator function that does just that for me. But I had to create as many "application" than percentage ratio proposed. And each .app are 1,7 Mo (that's the dirty part ;( ). So the all workflow is around 17 Mo to download! Usage: Select your image(s) from desktop or finder, type "resize" + TAB then select your preferred ratio and hit "ENTER" If you want to keep a copy of the resized image, press "CTRL" before "ENTER" Download: get it from GitHub Dependencies: None O.
  11. Hello Segphaul, this look really cool. unfortunately, I can't make it to work Do I need some python library install to make it work ? Like installing pygments? Am I the only one for whom this does not work out of the box ? O.
  12. Hello, Here is a yet another "System file show/hide toggle". Sorry for spamming, I should have search before, as wile writing this note, I see this have been done already here. You can still download it from GitHub. O.
  13. [sorry this workflow might interest only a limitted number of persons - I thought I would still share it here] WWDC Search 1.1 workflow Dependency: be registred as an Apple developper. This workflow comes with a bash script that download WWDC 2013 video sessions (and PDF presentations). To download WWDC sessions, you must have Apple developper portal credentials Usage: wwdc <keyword> Options: while typing "wwdc", you will have option to search for: the pdf (presentation) version of a session, then open it or download it if not already downloded. the video version of a session, then open it or download it if not already downloaded. particular keywords on asciiwwdc.com website (CMD+Y) for page preview. Recommended: use the bash script once to get downloaded all media and pdf files in one shot (25 GB for full list of SD videos) synthax: wwdcVideoPDFGet-curlVersion.sh my.appleid@me.com Download: - from Github page of wwdc-downloader bash script. - direct workflow download (that embed wwdc-downloader bash script) More: - more info on wwdc-downloader from my blog post. - a quick article I just wrote on this workflow. - video of workflow in action: http://vimeo.com/82106146 O.
  14. Hello mikedvzo, in my case LDAP request does not require authentication as it's 1) inside my company network and 2) the directory I'm querying does provide only basics info. If I needed to perform an authenticated request and take the password from keychain (while using python), I would start looking from there: https://pypi.python.org/pypi/keyring#what-is-python-keyring-lib Tell us if you can move forward with this ? O.
  15. I knew I would do something stupid. This is all me ;( Thanks for the tip! O.
  • Create New...