shiphero / shbin Goto Github PK
View Code? Open in Web Editor NEWturns a Github repo into a pastebin
License: MIT License
turns a Github repo into a pastebin
License: MIT License
suppose a file is a uploaded and upgraded. how can I retrieve the original version?
function to ask for repo and token and save it to an environment var
currently we can pass a url to dowload something but if only works if a url matches the given SHBIN_REPO
. we could relax this limit allowing a download also from any public repo.
For instance I could get all the textual docs source
$ shbin dl https://github.com/Textualize/textual/tree/main/docs
Consider this example
$ shbin Untitled.ipynb -d ci_naruto
๐๐
https://github.com/Shiphero/pastebin/blob/main/mgaitan/ci_naruto/Untitled.ipynb
That's correct . However, if I try to give it a name, the directory is ignored
$ shbin Untitled.ipynb -d ci_naruto -f analysis.ipynb
๐๐ https://github.com/Shiphero/pastebin/blob/main/mgaitan/analysis.ipynb
Add a manpage
A file could be automatically executed onlune passing a cli option shbin --exec ...
if this is given, we trigger a worflow running a proper environment (node, python, etc, selected by the extension) passing the uploaded file as argument. Any asset generated by the execution will be automatically uploaded to the pastebin.
the url to the run should be returned to the console.
It should be possible to reexecute files by url
for instance shbin -c "this is the snippet to upload"
Lines 107 to 109 in f320439
we need to fix it
implement as a subcommand
shbin dl https://github.com/Shiphero/pastebin/blob/main/mgaitan/7f6GRGhBtDg.md
shbin dl main/mgaitan/7f6GRGhBtDg.md
shbin dl mgaitan/7f6GRGhBtDg.md
shbin dl 7f6GRGhBtDg.md # assume user
<p align="center">
<img width="75%" src="https://gist.github.com/veracioux/66336d488e8d87c7b3fb696c5dbd93d1/raw/4b8bc0b043faf166abc92e12fc0bfb5acea55345/tuterm-demo.svg" />
</p>
shbin -x -a -f my_snippets.py
instead to update the whole file, it will append the content to the end.
add an option --wrap-as
(-w
) that wraps the content as a "code block" in a markdown file . For instance -w python
will produce a file with ".md" extension and the content
```python
<real content here>
`` `
I guess this than force the extension for a given snippet, and with #6 we could have several snippets in the same document.
a "git recent-branches" https://gist.github.com/mgaitan/ba1e4e252b90a7fd4a4eb9e1742e94fb for our latest uploaded files.
Currently we are iterating over the list of files to upload and the relying on create_file
(or update_file
) to commit the changes. It produce a commit per file and it could be slow
It's possible to commit all the changes in a single commit
check
Following the error, this is the problem, we have to send the sha of the file
/home/alvar/.pyenv/versions/3.11.2/envs/SHBIN/lib/python3.11/site-packages/github/Repository.py(2181)create_file()
2180 f"{self.url}/contents/{urllib.parse.quote(path)}",
-> 2181 input=put_parameters,
2182 )
ipdb> put_parameters
{'message': 'my cool demo script', 'content': 'aW1wb3J0IHRoaXM='}
ipdb> n
> /home/alvar/.pyenv/versions/3.11.2/envs/SHBIN/lib/python3.11/site-packages/github/Repository.py(2178)create_file()
2177
-> 2178 headers, data = self._requester.requestJsonAndCheck(
2179 "PUT",
ipdb>
github.GithubException.GithubException: 422 {"message": "Invalid request.\n\n\"sha\" wasn't supplied.", "documentation_url": "https://docs.github.com/rest/reference/repos#create-or-update-file-contents"}
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.