-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import json | ||
|
||
with open('clone.json', 'r') as fh: | ||
now = json.load(fh) | ||
|
||
with open('clone_before.json', 'r') as fh: | ||
before = json.load(fh) | ||
timestamps = {before['clones'][i]['timestamp']: i for i in range(len(before['clones']))} | ||
|
||
latest = dict(before) | ||
for i in range(len(now['clones'])): | ||
timestamp = now['clones'][i]['timestamp'] | ||
if timestamp in timestamps: | ||
latest['clones'][timestamps[timestamp]] = now['clones'][i] | ||
else: | ||
latest['clones'].append(now['clones'][i]) | ||
|
||
|
||
latest['count'] = sum(map(lambda x: int(x['count']), latest['clones'])) | ||
latest['uniques'] = sum(map(lambda x: int(x['uniques']), latest['clones'])) | ||
|
||
if len(timestamps) > 100: | ||
remove_this = [] | ||
clones = latest['clones'] | ||
for i in range(len(timestamps) - 35): | ||
clones[i]['timestamp'] = clones[i]['timestamp'][:7] | ||
if clones[i]['timestamp'] == clones[i+1]['timestamp'][:7]: | ||
clones[i+1]['count'] += clones[i]['count'] | ||
clones[i+1]['uniques'] += clones[i]['uniques'] | ||
remove_this.append(clones[i]) | ||
|
||
for item in remove_this: | ||
clones.remove(item) | ||
|
||
with open('clone.json', 'w', encoding='utf-8') as fh: | ||
json.dump(latest, fh, ensure_ascii=False, indent=4) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,23 +72,19 @@ jobs: | |
echo "[![GitHub Clones]($shields$url&logo=github)]($repo)" >> CLONE.md | ||
echo ' | ||
``` | ||
# https://repo-analytics.github.io/ | ||
# fetch-traffics: | ||
# runs-on: ubuntu-latest | ||
# name: daily-traffic-data-fetching | ||
# steps: | ||
# - uses: actions/checkout@v1 | ||
# - name: Use Node.js | ||
# uses: actions/setup-node@v1 | ||
# with: | ||
# node-version: 12.x | ||
# - name: npm install | ||
# run: npm install | ||
# working-directory: ./backend | ||
# - name: fetch | ||
# run: node scripts/dailyGetTraffics.js | ||
# env: | ||
# awsAccessKeyId: ${{ secrets.awsAccessKeyId }} | ||
# awsSecretAccessKey: ${{ secrets.awsSecretAccessKey }} | ||
# working-directory: ./backend | ||
**HTML** | ||
```html' >> CLONE.md | ||
echo "<a href='$repo'><img alt='GitHub Clones' src='$shields$url&logo=github'></a>" >> CLONE.md | ||
echo '```' >> CLONE.md | ||
git add CLONE.md | ||
git config --global user.name "GitHub Action" | ||
git config --global user.email "[email protected]" | ||
git commit -m "create clone count badge" | ||
fi | ||
- name: Push | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!DOCTYPE html><html><head><link rel="stylesheet" href="/fund/umi.css"><script>if(location.href.indexOf(`https`) > -1) { | ||
location.replace(`http://sunshowerc.github.io/fund/#/`) | ||
}</script><meta charset="utf-8"><meta name="”referrer”" content="”no-referrer”"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"><title>基金定投策略分析</title><script>window.routerBase = "/";</script></head><body><div id="root"></div><script src="/fund/umi.js"></script></body></html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#root,body,html{height:100%}body{margin:0}.main-title{font-size:24px;color:#333;padding:10px}.sub-title{font-size:16px;color:#bbb} |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.