Code Monkey home page Code Monkey logo

alfredgist's Introduction

Alfred Workflow - Gist

A workflow for Alfred to create Gists from your clipboard contents or selected files.

Example 1 Example 2

Requirements

Setup

This workflow requires API access to gist.github.com. This requires a personal access token. Follow these steps to create and configure this token into the workflow.

  1. Go to Personal access tokens in your account settings.
  2. Click Generate New Token.
  3. Enter in a reasonable token description such as 'Alfred Gist Workflow'.
  4. Ensure that the only selected scope is 'gist'.
  5. Click 'Generate Token'.
  6. Copy the newly generated token to your clipboard.
  7. In Alfred, type gistconfig and select the 'Your API access token is' line to set your token.

It should look something like this: Setup

Configure

Type gistconfig to view the existing configuration or change them. When changing the token and server the value is taken from the clipboard.

If you want to share your configuration across multiple machines (ie. via Dropbox) you can provide a shared configuration directory. This directory must exist before setting it via the configuration.

Help

Type gist help to view this help. If you need more help open an issue and I'll see what I can do.

Usage

Files

If activated as a file action, the contents of the selected file(s) will be gisted using whatever public/private setting is currently in effect.

Clipboard Contents

Public/private gists:

  • gist private - a private gist.
  • gist public - a public gist.
  • gist p - a gist using the opposite of your current public configuration value. That is, if by default your gists are private gist p will create a public one (and vice versa).

Anonymous gists:

Gists will be associated with your account by default.

  • gist a - an anonymous gist.
  • gist anon - an anonymous gist.

All of the following examples can take the public/private or the anonymous parameter (but only one of them) as the first argument.

  • gist rb - a gist with a filename of "gist.rb" (ie. Ruby syntax).
  • gist .rb - a gist with a filename of "gist.rb" (ie. Ruby syntax).
  • gist foo.rb - a gist with a filename of "foo.rb".
  • gist ipsum lorem - a gist with no filename/syntax and a description of "ipsum lorem"
  • gist - ipsum lorem - a gist with no filename/syntax and a description of "ipsum lorem"
  • gist .rb ipsum lorem - a gist with a filename of "gist.rb" and a description of "ipsum lorem"
  • gist foo.rb ipsum lorem - a gist with a filename of "foo.rb" and a description of "ipsum lorem"
  • gist rb ipsum lorem - a gist with no filename and a description of "rb ipsum lorem"
  • gist - foo.rb ipsum lorem - a gist with no filename and a description of "foo.rb ipsum lorem"

Note the lack of a period or the addition of "-" in the filename argument has when specifying a description.

Contributions & Thanks

  • JJ Asghar

License:

(The MIT License)

Copyright (c) 2012 Philip Hallstrom

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

alfredgist's People

Contributors

pash237 avatar phallstrom avatar prepor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

alfredgist's Issues

Gist causing CPU to spike

In the last couple of days, Gist does not seem to work any more and you see the following process somehow looping endlessly and resulting in high CPU usage:

bash gist.sh

python: command not found

Error Message:

[22:03:43.349] STDERR: Gist[[Run Script] functions.sh: line 236: python: command not found

I'm not sure how does the shim work for Alfred? I have python 2 installed via pyenv:

❯ which python                                                                                                                                                                          ─╯
/Users/liren/.pyenv/shims/python

❯ python --version                                                                                                                                                                      ─╯
Python 2.7.18

However the /usr/bin/python3 executable could be read by the Alfred Workflow, so I tried changing the script to python3:

echo -n "$1" | python3 -c 'import json,sys; print json.dumps(sys.stdin.read())'

But I don't think the string can be parsed correctly because I will still get error from gist API:

{
  "message": "Problems parsing JSON",
  "documentation_url": "https://docs.github.com/rest/reference/gists#create-a-gist"
}

Setup doesn't work with non-bash-like shell

My login shell is fish, which doesn't use bash setup. This causes gistsetup to fail horribly. This can be fixed by replacing the line of AppleScript in functions.sh that invokes setup.sh with this:

    do script with command "/bin/bash -c 'cd \"$OUR_DIR\" && /bin/bash setup.sh'" in window 1

Can't setup AfredGist

All I get is ERROR: An API error occured. even though I know for a fact I used the right credentials.

Overwrite prefix directory.

I use Alfred on multiple computers and using Alfred's sync feature is pointing to a dropbox . All configuration right now is per-box. So setting up a new box has a manual step of configuring this plugin.

It would be great to be able to overwrite the prefix directory.

Currently this is hardcoded over here:
https://github.com/phallstrom/AlfredGist/blob/master/gist.sh#L3

This could be overwritten in the plugin itself and the gist.sh only sets it if not currently set.

Can't set api key

So I try to add an API key on my second macbook but AlfredGist won't have it.
2014-08-21 16-36-18 2014-08-21 16-36-30
2014-08-21 16-38-03 2014-08-21 16-38-37

So what do I do?

Error sending a gist

It seems when i attempt to run "gist" i get an error.

Gist
ERROR: An API error has occured.

{"message": "Problems parsing JSON"}

I attempted to do a gist setup and no luck :(

ERROR: An API error occurred

Hi,
I've installed AlfredGist by following the instruction in the README file. I've created and successfully set the token but whenever I try to do anything with this extension I get the error "ERROR: An API error occurred".

FYI - I don't have any Alfred Gist or something like that in the authorized applications on GitHub. The extension didn't ask anything like that (and in case is required, it's not on the README).

Does not work on Alfred V3.x.x (?)

Trying to use this on Alfred 3.2.1 and every time I go to create Gist from clipboard, it tells me I need to configure gist via 'gist help'. I do this and it brings me here. Is there something else I can try?

Attempted to use a "bash" gist

So i used "gist bash"

and it looks like from my "date" command came back with a miss parsing.

origserver=web31                                                                 
origimage=$origserver-`date +%25F`                                                 
newserver=web32 

That should be

origserver=web31                                                                 
origimage=$origserver-`date +%F`                                                 
newserver=web32 

Open gists in raw format

Feature request: Is there a way to add an option to automatically open and copy the link to the raw gist? I wanted to modify this myself before requesting it here but I don't see where the gist.sh file is located.

Search gist then copy to clipboard

One feature that would be awesome would be to be able to search all your private gists (keyword, etc) and copy it to your clipboard.

This would then be a multi-clipboard tool that would have instant sync.

Submit Workflow to packal.org to enable auto updates

Hi, I use this Workflow quite a bit so thanks for making it.

I noticed that it was still writing to Library/Application Support/Alfred 2/Workflow Data/ even though I am using Alfred 3.

This was because I was using an old version. Any chance you can submit the Workflow to packal.org so updates can be pushed to the user?

Thanks

public gists

any way to modify this to create a public gist or use a parameter to create a public or private gist?

happy holidays

Don't have API Config option

I don't see to have the apiconfig option:

I wondered if I already set it up, but if I try to create a gist from the clipboard I get this:

Tolerant to more file format?

Trying to upload some .conf file, upon selection, the workflow returns a notification saying "An API Error occurs... message,..validation failed.."

Keep Gist description blank

Is it possible to have the newly created gist's description be NOT set to the text content and be just blank?

CleanShot 2023-01-26 at 17 28 07@2x

Can't create gist from ipynb files

Whenever I try to create a gist from an *.ipynb file, I get

ERROR: An API error occured.

{
  "message": "Validation Failed",
  "documentation_url": "https://developer.github.com/v3/gists/#create-a-gist",
  "errors": [
    {
      "resource": "Gist",
      "code": "missing_field",
      "field": "files"
    }
  ]
}

IPython Notebook files are just JSON. If I change the extension to *.py, it works fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.