codesnap.backgroundColor: The background color of the snippet's container. Can be any valid CSS color. codesnap.boxShadow: The CSS box-shadow for the snippet. Can be any valid CSS box shadow. codesnap.containerPadding: The padding for the snippet's container. Can be any valid CSS padding.
codesnap.roundedCorners: Boolean value to use rounded corners or square corners for the window.
codesnap.showWindowControls: Boolean value to show or hide OS X style window buttons.
codesnap.showWindowTitle: Boolean value to show or hide window title folder_name - file_name.
codesnap.showLineNumbers: Boolean value to show or hide line numbers.
codesnap.realLineNumbers: Boolean value to start from the real line number of the file instead of1.
codesnap.transparentBackground: Boolean value to use a transparent background when taking the screenshot.
codesnap.target: Either container to take the screenshot with the container, or window to only take the window.
codesnap.shutterAction: Either save to save the screenshot into a file, or copy to copy the screenshot into the clipboard.
Your git information is not valid Please run: git config --local user.name "<Your name in Microsoft>" git config --local user.email "<alias>@microsoft.com"
response data: {'status': 0, 'msg': 'ok', 'data': {'taskId': '1479436991'}} create task successfully 1479436991 polling result {'status': 0, 'msg': 'ok', 'data': {'status': 'Working'}} status of task Working polling result {'status': 0, 'msg': 'ok', 'data': {'status': 'Working'}} status of task Working polling result {'status': 0, 'msg': 'ok', 'data': {'status': 'Working'}} status of task Working polling result {'status': 0, 'msg': 'ok', 'data': {'status': 'Success', 'response': '03AGdBq27-ABqvNmgq96iuprN8Mvzfq6_8noknIed5foLb15oWvWVksq9KesDkDd7dgMMr-UmqULZduXTWr87scJXl3djhl2btPO721eFAYsVzSk7ftr4uHBdJWonnEemr9dNaFB9qx5pnxr3P24AC7cCfKlOH_XARaN4pvbPNxx_UY5G5fzKUPFDOV14nNkCWl61jwwC0fuwetH1q99r4hBQxyI6XICD3PiHyHJMZ_-wolcO1R9C90iGQyjzrSMiNqErezO24ODCiKRyX2cVaMwM9plbxDSuyKUVaDHqccz8UrTNNdJ4m2WxKrD9wZDWaSK10Ti1LgsqOWKjKwqBbuyRS_BkSjG6OJdHqJN4bpk_jAcPMO13wXrnHBaXdK4FNDR9-dUvupHEnr7QZEuNoRxwl8FnO2Fg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SaShEhXvByjkepvhrKX3kJssCU04biqqmkrQ49GqBV9OsWIy0nN3OJTx8v05MP8aU8YYkYBF01UbSff4mTfLAhin6iWk84Y074mRbe2MbgFAdU58KnCrwYVxcAR8voZsFxbxNwZXdVeexNx5HlIlSgaAHLWm2kFWmGPPW-ZA7R8Wst-mc7oIKft5iJl8Ea0YFz8oXyVgQk1rd9nDR3xGe5mWL1co0MiW1yvHg'}}
""" Parse the list of expenses and return the list of triples (date, value, currency). Ignore lines starting with #. Parse the date using datetime. Example expenses_string: 2016-01-02 -34.01 USD 2016-01-03 2.59 DKK 2016-01-03 -2.72 EUR """
Trained on billions of lines of public code, GitHub Copilot puts the knowledge you need at your fingertips, saving you time and helping you stay focused.
from flask import Flask, request, jsonify from loguru import logger
app = Flask(__name__)
@app.route('/sms', methods=['POST']) defreceive(): sms_content = request.form.get('content') logger.debug(f'received {sms_content}') # parse content and save to db or mq return jsonify(status='success')
if __name__ == '__main__': app.run(debug=True)
代码很简单,这里设置了一个路由,接收 POST 请求,然后读取了 Request 表单的内容,其中 content 就是短信的详情内容,然后将其打印出来。
我们将代码保存为 server.py,然后将其运行起来:
1
python3 server.py
运行结果输出如下:
1 2 3 4 5
* Debug mode: on * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) * Restarting with stat * Debugger is active! * Debugger PIN: 269-657-055
谷歌移动服务有一个简称,就是 GMS,英文是 Google Mobile Service,比如 Gmail、Google Play 等等都属于其中。华为不能使用 GMS,这对华为的海外市场可谓是一个巨大的打击。我们国内没法用谷歌的服务自然大家也习以为常了,所以这个变化对国内市场影响不大。然而华为主要消费群体不会局限于国内,国外也是一个非常重要的市场。GMS 之于国外用户就像微信之于国内用户,华为手机没法用 GMS,也就没法用 Google Play,没了 Google Play,那就连应用都没法好好地装了。有人会说,那我把 Google Play 等 App 的 apk 下载下来安装不就好了吗?不行的,没有 GMS,那就相当于就得不到 Google 的认证,所以即使是把 Google Play 的 apk 下载下来也是没法用的。所以,所有 GMS 的生态都没法用了,尤其对于那些已经重度依赖 GMS 的国外用户来说,对买不买华为手机是有非常大的顾虑的。
在去年的第一季度,华为的手机销量在全球是位居第一的,然而今年第一季度,华为的全球手机销量已经跌至第六,被三星、苹果、小米、OPPO、VIVO 赶超了,第五的 VIVO 是 10%,而华为今年第一季度已经跌到 4% 了。
嗯当然对于这种情形,华为也有自己的应对措施了。比如华为打造了 Huawei Mobile Service,即 HMS,但显然这个相比 GMS 还是有很多不成熟的地方,或者让用户从 GMS 迁移到 HMS,也一定是有很多顾虑和成本的。
Command line application to download youtube videos.
positional arguments: url The YouTube /watch or /playlist url
optional arguments: -h, --help show this help message and exit --version show program's version number and exit --itag ITAG The itag for the desired stream -r RESOLUTION, --resolution RESOLUTION The resolution forthe desired stream -l, --list The list option causes pytube cli to return a list of streams available to download -v, --verbose Verbosity level, use up to 4 to increase logging -vvvv --logfile LOGFILE logging debug and error messages into a log file --build-playback-report Save the html and js to disk -c CAPTION_CODE, --caption-code CAPTION_CODE Download srt captions for given language code. Prints available language codes if no argument given -lc, --list-captions List available caption codes for a video -t TARGET, --target TARGET The output directoryforthe downloaded stream. Default is current working directory -a [AUDIO], --audio [AUDIO] Download the audio fora given URLatthe highest bitrate availableDefaults to mp4 formatifnone is specified -f [FFMPEG], --ffmpeg [FFMPEG] Downloads the audio and video stream for resolution providedIf no resolution is provided, downloads the best resolutionRuns thecommandlineprogramffmpegto combinethe audio and video
2 00:00:13,400 --> 00:00:16,200 That is so awkward to watch. ...
对于播放列表的处理,比如新建 Playlist 对象,然后取出每一个视频的第一个视频流并下载:
1 2 3 4
>>> from pytube import Playlist >>> p = Playlist('https://www.youtube.com/playlist?list=PLS1QulWo1RIaJECMeUT4LFwJ-ghgoSH6n') >>> for video in p.videos: >>> video.streams.first().download()
另外还有一些异常处理机制:
1 2 3 4 5 6 7 8 9 10 11
>>> from pytube import Playlist, YouTube >>> playlist_url = 'https://youtube.com/playlist?list=special_playlist_id' >>> p = Playlist(playlist_url) >>> for url in p.video_urls: ... try: ... yt = YouTube(url) ... except VideoUnavailable: ... print(f'Video {url} is unavaialable, skipping.') ... else: ... print(f'Downloading video: {url}') ... yt.streams.first().download()
Github1s is based on VS Code 1.52.1 now. VS Code can be built for a browser version officially. I also used the code and got inspired by Code Server.
Thanks to the very powerful and flexible extensibility of VS Code, we can easily implement a VS Code extension that provides the custom File IO ability using FileSystemProvider API. There is an official demo named vscode-web-playground which shows how it is used.
On the other hand, GitHub provides the powerful REST API that can be used for a variety of tasks which includes reading directories and files for sure.
According to the above, obviously, the core concept of GitHub1s is to implement a VS Code Extension (includes FileSystemProvider) using GitHub REST API.
We may switch to the GitHub GraphQL API for more friendly user experience in the future, thanks to @xcv58 and @kanhegaonkarsaurabh. See details at Issue 12.
GitHub1s is a purely static web app (because it really doesn’t need a backend service, does it?). So we just deploy it on GitHub Pages now (the gh-pages branch of this repository), and it is free. The service of GitHub1s could be reliable (GitHub is very reliable) because nobody needs to pay the web hosting bills.
总的来说,GitHub1s 这个仓库是基于 VS Code 构建的,灵感来源于 Code Server 这个 Repo,地址为:https://github.com/cdr/code-server,这个就是一个 Online 版的 VS Code。
那作者基于这个做了什么事呢?
他基于 VS Code 提供的 FileSystemProvider API 对接了 GitHub 的 REST API 实现了这些功能。其中前者是 VS Code 提供的,可以提供文件读写操作,当然读写在线文件也是没问题的了;而后者是 GitHub 提供的,通过 REST API 可以获取 Repo 的文件夹或者某个文件。
For unauthenticated requests, the rate limit allows for up to 60 requests per hour. Unauthenticated requests are associated with the originating IP address, and not the user making requests.
对于未授权的请求,API 的请求频率是有限制的,每个 IP 每个小时访问限制是 60 次,所以用着用着就容易超限制了,可能就打不开文件了。
CORS Anywhere is a NodeJS proxy which adds CORS headers to the proxied request.
The url to proxy is literally taken from the path, validated and proxied. The protocol part of the proxied URI is optional, and defaults to “http”. If port 443 is specified, the protocol defaults to “https”.
This package does not put any restrictions on the http methods or headers, except for cookies. Requesting user credentials is disallowed. The app can be configured to require a header for proxying a request, for example to avoid a direct visit from the browser.
真是一个开源框架,和我猜的一样,就是一个解决跨域问题而生的反向代理。
然后我就在它的 README 中看到了这个:
好家伙,这不就是我刚才用到的链接吗?
那肯定是这个玩意出了什么毛病。
咋看呢?这个果断就是找 Issue 了:
一看,太明显了:
PSA: Public demo server (cors-anywhere.herokuapp.com) will be very limited by January 2021, 31st
意思就是从今年 1.31 开始这个网站的访问会受限,点进去看看:
The demo server of CORS Anywhere (cors-anywhere.herokuapp.com) is meant to be a demo of this project. But abuse has become so common that the platform where the demo is hosted (Heroku) has asked me to shut down the server, despite efforts to counter the abuse (rate limits in #45 and #164, and blocking other forms of requests). Downtime becomes increasingly frequent (e.g. recently #300, #299, #295, #294, #287) due to abuse and its popularity.
To counter this, I will make the following changes:
The rate limit will decrease from 200 (#164) per hour to 50 per hour.
By January 31st, 2021, cors-anywhere.herokuapp.com will stop serving as an open proxy.
From February 1st. 2021, cors-anywhere.herokuapp.com will only serve requests after the visitor has completed a challenge: The user (developer) must visit a page at cors-anywhere.herokuapp.com to temporarily unlock the demo for their browser. This allows developers to try out the functionality, to help with deciding on self-hosting or looking for alternatives.
-name:Autogreen run:| gitconfig--localuser.email"justjavac@gmail.com" gitconfig--localuser.name"迷渡" gitremoteset-urloriginhttps://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}} gitpull--rebase gitcommit--allow-empty-m"a commit a day keeps your girlfriend away" gitpush