defunkt / gist Goto Github PK
View Code? Open in Web Editor NEWPotentially the best command line gister.
Home Page: http://defunkt.io/gist/
License: MIT License
Potentially the best command line gister.
Home Page: http://defunkt.io/gist/
License: MIT License
While doing some testing with the new gist command in Pry (which uses the gist gem) when trying to create cases it would kick us out of the repl because https://github.com/defunkt/gist/blob/master/lib/gist.rb#L146 exists instead of raises. Since other applications could use this gem in their own gems could we please get gist to raise instead of puts and exit?
You can enable the embed code to work asynchronously by prefixing it with eval(document.write.START);
and postfixing it with eval(document.write.END);
, which does nothing at all, unless ADW is included on a page too, which uses magic (read: Error
s) to allow the document.write()
calls to be asynchronous.
For example, the following code:
document.write('<link rel="stylesheet" href="http://gist.github.com/stylesheets/gist/embed.css"/>');
document.write('<div id=\"gist-XXXXXX\" class=\"gist\">...gist here...<\/div>');
Would become:
eval(document.write.START);
document.write('<link rel="stylesheet" href="http://gist.github.com/stylesheets/gist/embed.css"/>');
document.write('<div id=\"gist-XXXXXX\" class=\"gist\">...gist here...<\/div>');
eval(document.write.END);
Edit: I seem to have discovered an issue with >
escaping in GitHub flavored Markdown by posting this issue. No idea where I'd report that though.
The README states, "You can also define github.token to be a command which returns the actual token on stdout by setting the variable to a command string prefixed with !." This doesn't work for me and I don't see any mention of it in the git-config man page. The closest mention is in the alias.* section, "If the alias expansion is prefixed with an exclamation point, it will be treated as a shell command." Am I missing something?
On a related note, I think the ability to store the token in the keychain is incredibly useful. The way I'm doing this currently is to set the GITHUB_TOKEN environment variable to the keychain command you have in the README.
export GITHUB_TOKEN=`security 2>&1 >/dev/null find-generic-password -gs github.token | ruby -e 'print $1 if STDIN.gets =~ /^password: "(.*)"$/'`
NOTE The command above differs slightly from the one used in the README in that I've removed the unnecessary backslashes around the double quotes.
I'm happy to issue a pull request with these changes to the README but I wanted to check that my understanding was correct first.
bug.
When I gist a file, it should set the gist filename to the name of the file I'm gisting.
It would be nice to be able to push an update to a gist, instead of only creating a new one.
ie, something like this.
$ echo file | gist
https://gist.github.com/$number
$ vim file
$ echo file | gist --update $number
gist < database.yml /usr/bin/gist:86: command not found: pbcopy Broken pipe Usage: gist [options] [filename or stdin] -p, --private Make the gist private -t, --type [EXTENSION] Set syntax highlighting of the Gist by file extension -m, --man Print manual -h, --help Display this screen
But the gist is created. Not sure what the errors are about, and it doesn't give me the URL for the gist.
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
setting user and token to empy strings should post anonymous.
see: https://github.com/mattn/gist-vim/blob/master/plugin/gist.vim#L728
lib/gist.rb was updated but gist is not updated.
$ gist notes.txt
if you run this command, it would be nice to add the file name "notes.txt".
Running gist on anything—file or stdin—produces this error:
invalid byte sequence in US-ASCII
Adding
#encoding: utf-8
to gist fixes the problem.
I am using the latest gist (2.0.1) and ruby (1.9.2p180).
% gist < file.java
/usr/lib/ruby/1.9.1/net/http.rb:1529:in dup': can't dup Symbol (TypeError) from /usr/lib/ruby/1.9.1/net/http.rb:1529:in
urlencode'
from /usr/lib/ruby/1.9.1/net/http.rb:1524:in block in encode_kvpair' from /usr/lib/ruby/1.9.1/net/http.rb:1524:in
map'
from /usr/lib/ruby/1.9.1/net/http.rb:1524:in encode_kvpair' from /usr/lib/ruby/1.9.1/net/http.rb:1517:in
block in set_form_data'
from /usr/lib/ruby/1.9.1/net/http.rb:1517:in each' from /usr/lib/ruby/1.9.1/net/http.rb:1517:in
map'
from /usr/lib/ruby/1.9.1/net/http.rb:1517:in set_form_data' from /usr/lib/ruby/1.9.1/net/http.rb:415:in
post_form'
from /usr/bin/gist:33:in write' from /usr/bin/gist:81:in
Hi, I just install gist from gem, but when ever I try to publish my gist, I got this:
[kissy master]: gist CHANGELOG
undefined method `empty?' for nil:NilClass
[kissy master]: gist -v
1.2.1
When I try to use the tool, I get this error.
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
I'd prefer not to disable the SSL verification to get this working.
I've used these commands to install gist from an Ubuntu version:
sudo apt-get install ruby
sudo apt-get install rubygems
sudo apt-get install libopenssl-ruby
sudo gem install gist
sudo cp /var/lib/gems/1.8/bin/gist /usr/local/bin/
gist -h
Am I missing something? I've also installed my token and user in the environment variables.
Title says it all
It'd be nice to use gist--without having to modify the source--for a GitHub:FI installation.
If I execute the script, no matter which form (stdin or file), just nothing happens.
I found out, that the script is always redirected
the proxy.post_form returns:
#<Net::HTTPFound 302 Found readbody=true>
req.body gives:
"You are being <a href="http://gist.github.com/gists/new\">redirected."
github.user and github.token in my git config are definitely set right.
When I run gist /opt/nginx/conf/nginx.conf
it fails with Creating gist failed: 200 OK
because it is trying to set the file name to the pull path, instead of just the filename (I assume).
I'm using 3.0.1
.
The --no-private
option does not work.
README.markdown says that gist.private is yes(private) by default.
So I ran this command.
git config --global gist.private no
But this also did not work.
So I can't create any public gist.
Hello,
Can someone of you help me out with Gist? I've installed it through Homebrew, and I have set my username and token inside my ~/.gitconfig
file.
However, I'm completely unable to paste anything to the gist
command. Is there any way for me to debug this?
Should be some ways for the command to check what is wrong, instead for spit out "nil".
Make the old school install technique:
curl -s https://raw.github.com/defunkt/gist/master/install | sh
Remove the $
from in front of all the shell snippets (follow github's example).
The link for the user's account token is https://github.com/account/admin
Thanks. Nice gister.
Hey there,
I frequently post diffs to gist. However, when I use your script to post a gist it comes out in raw format. Formatting it correctly is an extra manual step in what is otherwise a brilliantly automated process.
It would be nice if I could run your script using one or more of these syntaxes:
svn diff | gist --type diff
svn diff | gist -t diff
svn diff | gist --type=diff
This warning is emitted everytime gist is used.
Please add 2>&1 to the end of the system commands to suppress standard error as well.
I have a 5.5 MB file I'm trying to gist from the command line. The command exits and no URL or message is displayed. The file isn't posted to gist. I imagine the API is rejecting the file because it's too large. But there's no error message.
Sent the following using the command:
cat mytest.sh | gist -t sh
and Type on gist.github.com was set as Text (https://gist.github.com/2164325)
Also tried with a ruby file. (https://gist.github.com/2164428)
all of a sudden gist Creating gist failed: 422 Unprocessable Entity
stopped working
Since gist
is no longer standalone (it depends on other gems), we're probably going to remove it from Homebrew.
this doesn't seem to work
➔ echo "puts :hi" | gist --no-private -t rb
https://gist.github.com/710729
➔ gist -v
2.0.0
I'm having trouble with the http://github.com/defunkt/gist/commit/8e80c386206a8e997dcf094bc78ae366b83d9845 commit. It changed:
system("which pbcopy > /dev/null")
to:
system("which pbcopy &> /dev/null")
On my system this produces a error:
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31: command not found: pbcopy
I do not have pbcopy and system("which pbcopy > /dev/null") returns false, whereas system("which pbcopy &> /dev/null") returns true (I believe incorrectly).
Gists fails to create a new gist, and spits out the url http://gist.github.com/gists
After pasting, clone the gist for local backup and later edits.
The documentation says that gist.browse
defaults to yes, but in fact, it doesn't work by default. I think some special logic is needed in defaults
, like there is for gist.copy
, to make non-existence equal a default of true.
Title says it all
Versions prior to 2457f44 were able to read from current gists:
$ gist 1234 > something.txt
The ability to both write to and read from gists is extremely useful, thus this functionality should be restored in the current version.
It is a relatively simple task to decipher if a filename, gist ID or uri has been passed as an argument. For example if the filename does not exist, then it can be checked against a regex to see if it is a gist ID or uri. Alternatively a command line option can be specified when the result is ambiguous.
the username and password in the HTTPS_PROXY environment variable are being ignored, proxy auth fails
I suggest that, if gist is instructed to read standard input and there is nothing in it, it should spawns $EDITOR. It would make easier and faster to submit a gist. (Alternative: test if standard input is a TTY and runs $EDITOR if so. May be wait half a second?)
I am getting the following error
$ echo test | gist
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
Changing the following suppressed the error, although I doubt it is a proper fix.
diff --git a/lib/gist.rb b/lib/gist.rb
index 6ecc10a..be5b119 100644
--- a/lib/gist.rb
+++ b/lib/gist.rb
@@ -119,7 +119,7 @@ module Gist
end
http.use_ssl = true
- http.verify_mode = OpenSSL::SSL::VERIFY_PEER
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.ca_file = File.join(File.dirname(__FILE__), "cacert.pem")
req = Net::HTTP::Post.new(url.path)
Also note the following, even though I am currently using commit 1c27da3 (v2.0.0).
$ gist --version
1.4.0
I think somebody forgot to build gist in commit 83bf891. This shouldn't affect the current issue however, as it was just a version bump from v1.4.0.
Possible relevant info:
$ ruby --version
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
It would be good if the 2.0.2 release could get tagged in this repository so that the Homebrew formula could be updated.
Thanks!
I was trying to add a gist of a shell script which doesn't have a file extension, specifying -t sh and the filename of the script. But the explicit type given is ignored when filenames are given on the commandline, so my gist ends up being typeless.
It'd be nice to have a command line option for setting a description.
Thanks for this tool; it looks useful.
I was trying out the gist tool and it took a while to get going -- it turns out my config had "github.user" but not "github.token".
Steps to reproduce:
$ git config --unset github.token
$ gist --help | gist
nil
$ git config --unset github.user
$ gist --help | gist
https://gist.github.com/882916
This is already implemented in http://github.com/gtcaz/github-tmbundle/blob/master/Support/lib/gist.rb but I suggest a syntax along the lines of
gist filenamea.php filenameb.rb
or something.
since the gist api no longer seems to support tokens, it would be nice to be able to use the oauth2 mechanism for authentication.
Since my ~/.gitconfig is public, I cannot add my GitHub API token to it.
It would be useful to be able to specify the API token via the command line instead.
Alternatively, perhaps there's a way to use the public key from ~/.ssh instead?
When trying to upload a file, I get:
% gist run1.count
can't dup Symbol
Usage: gist [options] [filename or stdin] [filename] ...
....
% ruby --version
ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux]
I've updated to 3.0.0
and can't upload gists through the command line.
Both GITHUB_USER
and GITHUB_PASSWORD
environment variables are set correctly, and I've also updated my .gitconfig
with my password (still contains my Github token, too).
zachwill ✩ gist gist.txt
Creating gist failed: 400 Bad Request
zachwill ✩ gist < gist.txt
Creating gist failed: 400 Bad Request
I'm also using 1.9.3
if that helps:
zachwill ✩ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
$ brew install gist
==> Downloading https://github.com/defunkt/gist/tarball/v2.0.0
######################################################################## 100.0%
Error: MD5 mismatch
Expected: 4be2158b5a3d570f0f14d3ba092458db
Got: 509fac5c9d48b5e196b18278291dc46d
Archive: /Users/javan/Library/Caches/Homebrew/gist-2.0.0.0
(To retry an incomplete download, remove the file above.)
Using gist without setting the github info give a NoMethodError.
Though it is obvious you need these steps written in the documentation, I think the error should be more explicit ;)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.