// Round 1
// time: 21:26 - 21:44
// 默认最多尝试 3 次, 每次用时递减
// 缺点: 每次用时多少并不知道
// 失败: setTimeout 那里并没有 resolve, reject
function requestWithRetry(url, attempts = 3) {
const attemptsLeft = attempts - 1;
const maxDelayMS = 30000; // 30 seconds
const minDelayMS = 3000; // 3 seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your key bindings in this file to override the defaultsauto[] | |
[ | |
{ | |
"key": "alt+cmd+z", | |
"command": "git.revertSelectedRanges" | |
}, | |
{ | |
"key": "ctrl+tab", | |
"command": "workbench.action.nextEditor" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Cookies from 'js-cookie' | |
import { fromEvent } from 'rxjs' | |
import { buffer, debounceTime, filter, map } from 'rxjs/operators' | |
// debug 模式配置 | |
// 连续 5 次快速点击, 切换 debug 模式 | |
const FAST_CLICK_COUNT = 5 | |
const DEBUG_COOKIE_KEY = 'debug' | |
const clickStream = fromEvent(document, 'click') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return $.ajax({ | |
url: 'https://another-domain.com/api/user/', | |
type: 'GET', | |
dataType: 'json', | |
xhrFields: { | |
withCredentials: true, // this line is required | |
}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cut from the beginning of the video to the beginning of the unwanted part | |
ffmpeg.exe -ss 00:00:00.000 -t 00:19:00.000 -i original.mp4 -c:v copy -c:a copy part1.mp4 | |
# cut from the ending of the unwanted part to the end of the video | |
ffmpeg.exe -ss 00:20:28.000 -t 01:26:25.000 -i original.mp4 -c:v copy -c:a copy part2.mp4 | |
# create a list file | |
touch list.txt | |
echo file part1.mp4 > list.txt | |
echo file part2.mp4 >> list.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if ethtool wlp2s0 | grep -q "Link detected: no"; then | |
echo connecting | |
echo $(nmcli d connect wlp2s0) | |
else | |
echo connected | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ref: https://codepen.io/shrekuu/pen/zYoQoBd?editors=1010 | |
var container; | |
var camera, scene, renderer; | |
// Sphere 1 | |
var sphereGeometry1, sphereMaterial1, sphereMesh1; | |
// Sphere 2 | |
var sphereGeometry2, sphereMaterial2, sphereMesh2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ref: https://askubuntu.com/a/421751/596437 | |
wlan=`/sbin/ifconfig wlp2s0 | grep inet\ addr | wc -l` | |
if [ $wlan -eq 0 ]; then | |
/sbin/ifconfig wlp2s0 down && /sbin/ifconfig wlp2s0 up | |
else | |
echo "interface is up" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SwitchyOmega Conditions] | |
@with result | |
*.fonts.googleapis.com +A | |
*.bootstrapcdn.com +A | |
*.regex101.com +A | |
*.sentry-cdn.com +A | |
*.google.com +A | |
*.cloudinary.com +A | |
*.jsplumbtoolkit.com +A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import environment from './environment' | |
// 把字体资源放到后端服务器上 | |
// 使这样可以访问到 ${environment.baseURL}/vendor/fontawesome-5.8/webfonts/fa-regular-400.woff | |
// 服务器要上 https + CORS | |
// 更多参考: https://developers.weixin.qq.com/miniprogram/dev/api/wx.loadFontFace.html | |
// 如果实在不稳定, 就使用 http://fontello.com/ 生成 base64 样的字体内嵌风格 css 使用 | |
// 尝试动态加载的字体图标 | |
const fontAwesomeFonts = [ |
NewerOlder