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
version: "3" | |
services: | |
clash: | |
container_name: Clash | |
image: dreamacro/clash-premium | |
restart: unless-stopped | |
privileged: true | |
devices: | |
- /dev/net/tun | |
volumes: |
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
<?php | |
/* | |
* 经典的概率算法, | |
* $proArr是一个预先设置的数组, | |
* 假设数组为:array(100,200,300,400), | |
* 开始是从1,1000 这个概率范围内筛选第一个数是否在他的出现概率范围之内, | |
* 如果不在,则将概率空间,也就是k的值减去刚刚的那个数字的概率空间, | |
* 在本例当中就是减去100,也就是说第二个数是在1,900这个范围内筛选的。 | |
* 这样 筛选到最终,总会有一个数满足要求。 | |
* 就相当于去一个箱子里摸东西, |
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
get(url, headers) { | |
return new Promise(function (resolve, reject) { | |
fetch(url, { | |
headers: headers, | |
}) | |
.then(response => response.json()) | |
.then(data => resolve(data)).catch((error) => { | |
reject(error) | |
}); |
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
<template> | |
<svg class="icon" aria-hidden="true" :width="fontSize" :height="fontSize"> | |
<use :xlink:href="class" :fill="color"></use> | |
</svg> | |
</template> | |
<script> | |
import { defineComponent } from "vue"; | |
export default defineComponent({ | |
created() { |
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
class FileHelper { | |
FetchToBlob(url, opt = {}) { | |
return new Promise((reslove, reject) => { | |
if (!url) { | |
reject() | |
return | |
} | |
fetch(url, opt).then(function (response) { | |
if (response.ok) { | |
reslove(response.blob()); |
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
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": "*", |
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
// Golang example that creates an http client that leverages a SOCKS5 proxy and a DialContext | |
func NewClientFromEnv() (*http.Client, error) { | |
proxyHost := os.Getenv("PROXY_HOST") | |
baseDialer := &net.Dialer{ | |
Timeout: 30 * time.Second, | |
KeepAlive: 30 * time.Second, | |
} | |
var dialContext DialContext |
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
@color 0A | |
@title 修改远程桌面端口号 | |
@echo off | |
echo 请输入端口号 | |
set /p port= | |
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /t reg_dword /d %port% /f | |
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t reg_dword /d %port% /f | |
exit |
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
.PHONY: resetgit | |
resetgit: | |
git checkout --orphan latest_branch | |
git add -A | |
git commit -am "init repo" | |
git branch -D master | |
git branch -m master | |
git push -f origin master |
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
clean-deleted-space() | |
{ | |
DELETED_FILES=$(cat << EOL $(lsof 2>/dev/null | grep -s deleted | grep -Po "\w+\s+\w+\s+/.*" | awk '{print $1" "$3}' | sort -u | grep -v '^0') | |
EOL | |
) | |
cat << EOL | awk '{sum+=$1} END {print "Will released: "sum/1024/1024" Mb"}' | |
${DELETED_FILES} | |
EOL | |
ONLY_FILES=$(cat << EOL | awk '{print $2}' | grep '^/' | |
${DELETED_FILES} |
NewerOlder