Jump to content

aviris

Member
  • Content Count

    12
  • Joined

  • Last visited

  1. Download Here This Alfred Workflow will take the active Finder window and serve it up with Harp (http://harpjs.com) web server at localhost:9090. It even opens Safari to http://localhost:9090 for you.** Triggering the workflow while a Harp instance is already serving a Finder directory increment the port number by one (e.g. http://localhost:9091), allowing you to serve several different folders at the same time on your machine. Harp web server automatically preprocesses Jade, Markdown, EJS, CoffeeScript, Sass, LESS and Stylus and serves it as HTML, CSS & JavaScript—no configuration necessary. It even does the vendor prefixing for you. Prerequisites: Harp Web Server - Node (http://nodejs.org) - NPM (included with Node) Once you have installed Node, install Harp with npm install -g harp Harp Quick Start ** This is my use of AppleScript so by the time I got the Terminal window checking and port incrementing working I just put a simple 2 second delay before calling Safari. If Terminal isn't open and Safari is, depending on your machine it may take more than 2 seconds for Harp to initialize. Just hit the reload button in Safari. Or change it to wait a bit longer. Or if you are an AppleScript guru, fix it to wait until Harp is running, then call Safari. Feel free to modify the Applescript for whatever shell commands you may want to issue - I know Harp isn't the only Node based web server around.
  2. Any word on when/whether custom fonts will be available for theming? I looked through all the release notes and searched the forum but didn't see any further mention of this topic. Thanks.
  3. Thanks for the comments David. The more I think about this, it is a bit more tricky than I originally thought about it. Here's my thoughts for what they are worth: I understand what you are saying, but there are a few things that work against that best practice. First, many scripts are something simple enough to be done in a few lines in the Script box. This is where the simplicity of Alfred works against itself because someone doing a quick script doesn't really think about best practices. They just write the script and it works. What's to think about? Here's Brett's Cheaters workflow, and since the script is all in the Script box it lives inside the Alfred Sync folder. Unfortunately the script has a path to launch the Cheaters program on a user machine, so if the path to Cheaters is different on my laptop and desktop, the Workflow is broken on one or the other all the time. So while it is possible to do like your Weather workflow and have a file over in Application Support that only stores my zip code and doesn't get synced, either people don't know how to do that or it is too much trouble for a simple script. There is also the fact that for many workflows you'll want that information synced and having to set it twice is the hassle. CHEATERS_DIR="file:///Users/aviris/Dropbox/cheaters/index.html" TESTPATH=$(echo "$CHEATERS_DIR" | sed -e 's/file:\/\///') if [[ -f $TESTPATH || $TESTPATH =~ "http://" ]]; then automator -i "$CHEATERS_DIR {query}" Cheat.workflow else echo "Cheaters path not valid" fi A quick check of my user Application Support folder supports this view since of all my installed workflows, only your Alfred Tweet, Recent Docs, Weather, and Tyler Eich's Colors are storing anything here. Everybody else seems to be keeping it all in the Alfred.alfredpreferences/workflow directory where it will sync. So even though it is recommended, it doesn't appear that many are doing it other than yourself. Even if you could get everyone to write their workflows properly, it doesn't address the issue of the all or nothing sync. Maybe there aren't too many people in this situation, but I have many more workflows on my primary machine than I don't need/want on my laptop so a "Sync/Don't Sync" option would be nice. It would take care of both problems and allow the end user to "fix" things that the workflow creator should have done. Hopefully that helps clarify my request. When I posted it I was thinking of it as a "would be nice" request (and below user selectable fonts if I'm honest). Now it is more of a contribution of use practices as you think about what to do with the syncing. The fact that for some workflows it makes sense to sync configuration data and for some it doesn't makes it a tough topic.
  4. It would be very nice to be able to selectively sync certain workflows. I have Alfred on my primary machine (Mac Pro) and on my laptop. Due to very different storage configurations there are some paths that are just not the same between the new machines. Example #1 When I try and launch Cheaters via Alfred even though the cheat docs are in my Dropbox folder in the same place, the path to the Dropbox folder is in a different place on my desktop vs. laptop. Initially I kept a snippet with the correct path for each machine and I'd just open the workflow and paste it in. It works but is slow. Because I'm a bit dim sometimes it didn't occur to me to use symbolic links on one of the machines so that the workflow works both places now. Still, it would be nice to be able to change the workflow on one machine and then just mark it as Do Not Sync anymore. Example #2 As I've been writing this I was thinking of another use scenario. There are several workflows I want to be the same on both machines, but there are a bunch of workflows that I just don't need on my laptop. In those cases too it would be nice to not have sync be an all or nothing scenario. Just a toggle for Sync/NoSync
  5. What? Actually it is not only a good idea but necessary for people who (like me) do a lot of cartography and design work and have literally tens of thousands of fonts that I need access to on occasion. Having them all enabled all the time is a needless slowdown on my system. When troubleshooting printing problems fonts can also be troublesome so knowing how to safely disable and re-enable fonts is something every use should know how to do. The only danger of disabling fonts is if you muck about in the font directories and move and/or throw away the font files. Alfred just needs a warning to reenable a font it needs and/or the ability to fallback to a default font in the meantime.
  6. +1 I too tried editing the font section of the theme and got Helvetica. Strangely if one of the default fonts is disabled, it doesn't default or warn, just doesn't accept any input
  7. Alfred v 2.0.3 (187) OS 10.8.3 1 - I applied a new theme (Pastel Sky by ebence). 2 - I triggered Alfred and got a pretty box, but nothing happened when I attempted to type. I tried several times. Opened workflows, could type, just not in the actual Alfred box. I quit and restarted Alfred. Still wouldn't register any keystrokes. 3 - Changed the theme - everything works great. When I changed back I noticed in the preview of the theme had a very small font that didn't look like the screenshot on the forum. 4 - Realized that in an attempt to solve a problem with Acrobat XI Pro I had disabled most of my fonts. 5 - Re-enabled Futura font and it all worked. I don't know how often this would come up, but it would be nice that if the fonts used by Alfred weren't available that it would tell you or default back to Helvetica & tell you so.
  8. I know nothing about AppleScript, but it may be time to get out of my shell a bit (pun intended). This is perfect for what I was trying to do at first - create a workflow that could be shared without requiring the editing of the sudoers file. I'll still do it so that I don't have to provide authentication, but this allows modifying personal workflows for general consumption. Off to do some reading
  9. Thanks for the confirmation of my own thoughts. I removed the link to the workflow for now. I never shared any of my extensions in v1 because they were always mostly unique to my computer because of reasons like this. More of a step in a workflow than an entire workflow. I thought this closed beta forums would be a good place to ask about the interest level. Perhaps a forum category that people could talk about this type of thing without actually sharing workflows out where they could do damage and let each person work his own. Any thoughts on why sudo -S won't work with your password as an argument? Then sudo is still being used interactively like it was meant to be and workflows could be distributed without modifications external to Alfred needed. If I could figure out passing passwords in Alfred I could also bind a query like mysql -u root -p running -e "select * from running" to a keyword to just check whether or not MySQL was up and running properly. Again - it takes some planning (in this case a table called running with a single record saying "Ready"). I actually checked out big PHP and Shell Scripting books from my library this morning. We'll see if I can find some time to learn more useful and shareable things to do with Alfred. Thanks again for your comments and workflows.
  10. Sorry this is long - but it is a bit complex. I intermittently do web development work and prefer to develop it all on my local machine, but don't want Apache & MySQL running all the time. So I thought I'd make a quick workflow to allow me to start, stop and restart these services. The normal procedure would be to open Terminal and type: sudo apachectl stop password sudo mysql.server stop no password 2nd time because it's good for 5 minutes. Substitute start or restart as necessary. * This assumes you have set up your paths correctly (use sudo vi /etc/paths), otherwise you will need to type: sudo /usr/local/mysql/support-files/mysql.server stop and the equivalent for apache So, I made a quick keyword workflow with a required argument (your password) which is passed to a script like: echo "{query}" | sudo -S apachectl stop Unfortunately it doesn't work. I double checked the sudo man pages, looked around the Internet and found others who said this was the way to script sudo commands requiring a password. Still no luck in Alfred. Probably for the best in the long term, I gave up on that and took the steps to set up my machine to do this properly. I was trying to do it this way so that the workflow could be portable to other machines without any other steps (and soothed my conscious about scripts with plain text passwords by telling myself that it wasn't stored anyplace). So here's my question. Would a workflow like this be desirable/of use to others if it requires a little work of a somewhat esoteric nature to set up your computer properly to work? Specifically it requires that you edit your sudoers file (sudo visudo) to allow you to run these specific commands without a password. Here's what my sudoers file looks like now: # sudoers file. # # This file MUST be edited with the 'visudo' command as root. # Failure to use 'visudo' may result in syntax or file permission errors # that prevent sudo from running. # # See the sudoers man page for the details on how to write a sudoers file. # # Host alias specification # User alias specification # Cmnd alias specification Cmnd_Alias ASTART = /usr/sbin/apachectl start Cmnd_Alias ASTOP = /usr/sbin/apachectl stop Cmnd_Alias ARESTART = /usr/sbin/apachectl restart Cmnd_Alias MYSTART = /usr/local/mysql/support-files/mysql.server start Cmnd_Alias MYSTOP = /usr/local/mysql/support-files/mysql.server stop Cmnd_Alias MYRESTART = /usr/local/mysql/support-files/mysql.server restart Cmnd_Alias WEBCTL = ASTART,ASTOP,ARESTART,MYSTART,MYSTOP,MYRESTART # Defaults specification Defaults env_reset Defaults env_keep += "BLOCKSIZE" Defaults env_keep += "COLORFGBG COLORTERM" Defaults env_keep += "__CF_USER_TEXT_ENCODING" Defaults env_keep += "CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE" Defaults env_keep += "LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME" Defaults env_keep += "LINES COLUMNS" Defaults env_keep += "LSCOLORS" Defaults env_keep += "SSH_AUTH_SOCK" Defaults env_keep += "TZ" Defaults env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY" Defaults env_keep += "EDITOR VISUAL" Defaults env_keep += "HOME MAIL" # Runas alias specification # User privilege specification root ALL=(ALL) ALL %admin ALL=(ALL) ALL aviris mycomputername=(root)NOPASSWD:WEBCTL # Uncomment to allow people in group wheel to run all commands # %wheel ALL=(ALL) ALL # Same thing without a password # %wheel ALL=(ALL) NOPASSWD: ALL Rather than doing the command aliases, you could just put multiple lines under the User privilege specification. Once the sudoers file is setup properly the workflow is dead simple, just two lines issuing the start, stop, or restart commands (made simpler if you have set up the paths file). I'm still thinking on the best way to query the two servers afterward to be able to provide some feedback. Right now I just have it open a phpinfo page at localhost and if I see it, then it started/restarted. If it says it can't connect, it stopped. I'm no programmer, so maybe there are ways to do this sort of thing using PHP (looks at David Ferguson), but as I'm writing this I'm thinking of several other things I could do with Alfred and the sudoers file. Looking through the forum I didn't see any workflows using sudo commands so maybe I'm missing something. You'll notice I didn't use any *'s anyplace or do anything crazy like make an Alfred group and say members can do anything without a password, but the potential is there I suppose. So that brings me back to my question about making and sharing workflows that require mucking about with some potentially sensitive settings. Thoughts?
  11. I like the blur effect, so I hope it doesn't go away (not that I'd moan to you about it). I'm curious where the font choices are coming from? Is there any possibility of dropping selected fonts in a certain location that Alfred could use? Menlo is easy to read, but I'd like to experiment with other fonts. Click screenshot to download .alfredappearance file.
×
×
  • Create New...