Skip to content

Instantly share code, notes, and snippets.

@devadvance
devadvance / part_video_to_gif.sh
Created February 28, 2021 03:10
Create animated GIF and WebP from videos using ffmpeg
ffmpeg -ss $INPUT_START_TIME -t $LENGTH -i $INPUT_FILENAME \
-vf "fps=$OUTPUT_FPS,scale=$OUTPUT_WIDTH:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
-loop $NUMBER_OF_LOOPS $OUTPUT_FILENAME
# Change these placeholders:
# * $INPUT_START_TIME - number of seconds in the input video to start from.
# * $LENGTH - number of seconds to convert from the input video.
# * $INPUT_FILENAME - path to the input video.
# * $OUTPUT_FPS - ouput frames per second. Start with `10`.
# * $OUTPUT_WIDTH - output width in pixels. Aspect ratio is maintained.
@mwufi
mwufi / install_docker_in_colab.sh
Last active April 14, 2024 10:53
Install Docker in Google Colab!
# First let's update all the packages to the latest ones with the following command
sudo apt update -qq
# Now we want to install some prerequisite packages which will let us use HTTPS over apt
sudo apt install apt-transport-https ca-certificates curl software-properties-common -qq
# After that we will add the GPG key for the official Docker repository to the system
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# We will add the Docker repository to our APT sources
@zhaokuohaha
zhaokuohaha / 微信公众号获取用户基本信息的方法总结.md
Last active March 26, 2024 16:16
包括:服务号, 订阅号, 开放平台 , 以及在各个场景下应选择何种方式获取等

背景: 折腾了一整个周末,终于把用通过微信进行获取用户信息,以用来进行账号注册登录的问题搞定了, 因为面对的问题比较棘手: 希望通过微信订阅号获取用户信息授权,在自己开放的网站(所谓第三方网站)拿到用户信息, 所以在解决问题的过程中,顺便把自己期望实现的方式,以及现有的方式也稍微了解了一些, 所以趁此机会做一个整理。 因为朋友的网站是 php 开发的,所以下面的代码会以 php 进行举例,尽管我对 php 并不熟悉, 但是现在懒得重新去实现一遍了, 后面再说吧, 如果有后面的话。 其实其他语言理论上可以很容易类比, 因为微信的这些接口都是 restful 的 http 接口。

概述

微信授权登陆, 从使用入口来说,主要是 PC 端网站, 移动端网站和 APP。 这里的“移动端网站”是指从微信浏览器打开的网站,如果从手机浏览器打开, 那么只能与PC端的授权方式一样(实际上操作很麻烦) 基本的授权方式如下:

  • PC 端网站: 打开一个二维码, 用户扫描二维码之后授权 -> 获取用户信息
  • APP: 点击授权后跳转到微信授权页面, 用户点击确认授权 -> 获取用户信息

以上两种方式基本可以通过微信开放平台实现。

@mayneyao
mayneyao / notion2blog.js
Last active February 29, 2024 18:01
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",