Jump to content

Search the Community

Showing results for tags 'Web Server'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Alfred 3
  • Make the Most of Alfred
    • Discussion & Help
    • Bug Reports
    • Alfred Feature Suggestions
    • Themes
  • Alfred Workflows
    • Share your Workflows
    • Workflow Help & Questions
  • Alfred v2 Themes
  • Alfred Remote for iOS
    • Alfred Remote Discussion & Help
    • Remote Connection Troubleshooting

Categories

  • Articles
    • Forum Integration
    • Frontpage
  • Pages
  • Miscellaneous
    • Databases
    • Templates
    • Media

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Twitter


Website URL


Jabber


Location


Interests

Found 4 results

  1. This workflow will take the focused/front Finder window and create a temporary Python Server at that location, using `python -m SimpleHTTPServer`. Function will also open the default web server URL (http://0.0.0.0:8000) in the default browser when the python server has started. This is an extremely handy way to quickly test code in a server environment, especially when working with cross-domain functionality that will not work from localhost/local file server. Basically allowing you to create an ad-hoc/on-demand web server at any Finder location on your mac. Borrows some of the Terminal Finder functionality from Chris Yip's "Terminal Here" workflow: http://chrisyip.im/ Download: http://cloud.joshuarhoades.com/3O0c1h3P250l
  2. 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?
  3. 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.
  4. Few new workflows @ https://github.com/chintanbuch/Alfred-Workflows Precise Age Calculator Convert Epoch/Unix time to readable Date Time Get Web Server Header
×
×
  • Create New...