Jump to content

_oho

Member
  • Posts

    30
  • Joined

  • Last visited

Everything posted by _oho

  1. Ok, think I found it (may be ? At least I get it to work). Had activated logs (cool feature) and seen error is coming from `chatgpt` script. Editing this script I can't see the use of `chatgpt_api_endpoint` variable. In stead `dalle_api_enpoint` only is used (may be for ChatGPT and DALLE ?). const apiEndpoint = envVar("dalle_api_endpoint") || "https://api.openai.com As anyway I have no paid credit for Dalle, so I have overrided `dalle_api_endpoint`in Environement Variable. And it seems to work. Thank you for your quick answer yesterday and thank you for you enormous / genius Workflow that I love. Actually make me remind how great is Alfred... Can't wait for your new version that will fix allow easy integration off other models (like Ollama). Was wondering, do you think there is a way to get code synthaxic coloration in ChatGPT workflow answer ? O.
  2. Thank you Vitor for removing my post. I realized it was not appropriate as it was a real salvage dirty hack :). To be honest I haven't played with Alfred workflows for around 10 years. Just using it (every day) without modifications. I have to admit that it have improved so much (congrats to the team by the way). I have tried your preview but can't make it work :(. I have only change in environment variable : `chatgpt_api_endpoint` (don't know what entry is expected on `chatgpt_model_override` as changing this does not seems to help). Changed also `gpt_model` in Configuration Builder to add my own local currently used models. Than could change my chosen model in `Configure Workflow`. Buty whatever I do, I keep having API key error, meaning it's not using my local endpoint Any idea ? Hope this is not a very dump thing I'm doing wrong (I'm sure seeing how dirty I can hack, you would not be surprised ). O.
  3. Actually, you can use Ollama (https://github.com/ollama/ollama) to serve locally any available open source models (including gemma from Google, llama2 from Meta, or Mistral from the French startup, but many others ...). Ollama is compatible with OpenAI API so I just hacked a bit the current workflow by changing `chatgpt_api_enpoint` to `http://localhost:11434` + changing model name and label in `userconfigurationconfig` And to my great surprise it works ... Of course, I believe your mac should be robust enough. Forget to mention I have a M3 Max with 48 Go of RAM. But I'm pretty sure it's reasonably work on a M1 with 8 Mo of RAM. On my M3 answer is very fast. It would be good to have an update of the workflow that would add the option (+ howto) to use Ollama... _oho.
  4. )) 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
  5. 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
  6. 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.
  7. 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.
  8. 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
  9. 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.
  10. "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.
  11. 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.
  12. 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.
  13. [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.
  14. 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.
  15. 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.
  16. [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.
  17. 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.
  18. I knew I would do something stupid. This is all me ;( Thanks for the tip! O.
  19. Hello, Sometimes I'm in a meeting and I want to speak to my nearby colleague without talking too loud ... During last meeting I end up writing this simpler ever workflow to do this. It's that simple that it might already exist, but was quicker to develop this than to search for it out there. What it does: Display argument as Large Type Dependencies: None! Here it is for download O.
  20. Hello, [This comment is only useful for people like me that does not read Workflow "read me" It's only after having written this comment that I red the read me that would have easily let me solved all my issues at the first place ... This say, still useful for getting black theme icons] Thank you for your nice workflow. I have an netatmo system at home and because I'm french, I have my settings in french. This caused the workflow to fail with a python KeyError: 'Indoor' error. So for French localised system properties.py file (from workflow folder) need to have some key changed as bellow: _INDOOR_UNIT = "Intérieur" _OUTDOOR_UNIT = "Extérieur" I also had an issue with my python path So the only way I could make it work was to copy the workflow python script into Workflow folder (atmo.py for instance) and call it from bash with my proper python3.3 path. This atmo.py have then my correct full ( tild does not work) python path set (ex: #!/Users/oho/.virtualenv/python3.3/bin/python) Also, I did not know at first what to put in: _CLIENT_ID = "" # From Netatmo app registration _CLIENT_SECRET = "" even if it's written # From Netatmo app registration (AND in the read me) ... - I know sometime reading comments is useful ... So for some that does not read comments, you can get your _CLIENT_ID and _CLIENT_SECRET by creating an app at Netatmo developer portal. Finally, I have Alfred2 Dark theme, so the black icons are not visible on black background. I have quickly re-colorised them as shown bellow: Here is my french localised version settings + black theme adapted icons for download! O.
  21. Hello, Here is a workflow that let you choose between preconfigured iTerm2 windows/panes configurations. This is useful when you have to work with different terminal windows. And possibly launch remote ssh session in each one to process some "tail -f" kind of real time log analysis. This workflow is an Apple Script script that embed your windows configuration. So you have to configure/set/change the configs you will call as parameter from the keywords. Dependencies: iTerm2. Configuration: At top of AppleScript. Download: Alfred2-iTerm2 on GitHub. Olivier.
  22. Hello, Here is a quick workflow that search over an ldap directory. Query string is passed to a python script that request ldap and parse result. Result is displayed as a list and action to an item does actually call DeskConnect. But you could easily customise with your preferred action like call SIP or send email, etc. This workflow came after discussion on ldap topic here. Great support from community (in particular David and Shawn). Dependencies: Python 2.5. (probably compatible with all python 2.x); DeskConnect (optional) Configuration: within Python script (ldap address + some few params - see Github Readme). Download: LDAP.alfredworkflow on GitHub Feel free to suggest improvements (or improve by yourself of course). Any feedbacks also welcome. Thank you! Olivier.
  23. You are right. Just before reading at your post, I was even asking myself if this should not be something separate like either call from ldap, either add to address book. It's always goo to keep things as simple and basic as possible. But if I keep it mixed up, I will make it very clear (100% agreed with you). In a mean time, I told too fast that it was done, as if the principle of adding a contact was tested and validated with the Applescript, I still have to add some more processing to get all the fields passed into the query and spread again in all different address book fields after. I'll do that once, I'll have all the magic fields missing (image, mobile number, address, department, SIP address, etc.). O.
  24. Wouao!! This is a lot of information. Thank you very much Shawn! I'll have a look a those as soon as possible. Since my post I have added a quick extra Apple script (not yet committed) that add the contact to local contact app (only when selected for dialling over DeskConnect). So that it will be part of local result when searching for this contact the next time. Next step will be to work with authentication for getting more ldap info (in particular person picture). I love Alfred ! O.
  25. Hello David and Shawn, thank you for your suggestions. I think I understand that for displaying result, I should generate for each contact a local html page so that I can popup (Shift or Cmd+Y) a preview url to show contact details. Correct ? I had initialy a secret expectation to be able to trick Alfred system and use contact detail display page (where you can select each element like, phone, email, etc.), see the person picture exactly like contact detail page show it, etc. I understand that this is not achievable as Alfred2 contact detail page is really a build-in non customer available type of page display. Right ? Is there any trick I could use (except may be creating/adding on the fly a real contact when selecting a result)? Concerning contact icons/images, so far, I can't get them from ldap (I need to do authenticated request that I don't know yet how to do - I'm reverse engineering company IS there) so I'll postpone some thinking on caching and performance management until then (thank for your reco Shawn). The good news: I could test/fix this morning (Paris time) a workflow which is now fully working: 1) get search key from 'ldap' keyword 2) display result as list of names (with phone number and email as subtitle) 3) click on name does initiate a call through DeskConnect (I saw this week-end post on the app applescript integration - I was already using this app and didn't used this feature before => awesome) The good part: the workflow is more than 10 times faster than other internal company solutions (query from contact app, or web intranet/interface). I have committed the workflow to github as I don't know how to attach a file here (do I need to be more senior in the forum to be able to share attachments ?). Here is LDAP.alfredworkflow for download from github. If someone want to use this workflow, some settings need to be customised (like ldap server url, domain, etc. - see python script for more details). Also, launching DeskConnect could be replaced by SIP call or email sending for instance. Quick other question: is there a way I could suggest a key option for choosing action from names list like "DeskConnect call" or "send email" ? O.
×
×
  • Create New...