Skip to content

Instantly share code, notes, and snippets.

@ficapy
Created February 23, 2016 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ficapy/95194fbc9b28cd26bd95 to your computer and use it in GitHub Desktop.
Save ficapy/95194fbc9b28cd26bd95 to your computer and use it in GitHub Desktop.
今天开始学C#,找几个小项目看源码练练手
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
# Create: '16/2/23'
import sys
if sys.version_info[0] < 3:
sys.exit(1)
from github import Github
from subprocess import getoutput
import shutil
import time
USER = ''
PWD = ''
repo_number = {}
g = Github(USER, PWD)
for repo in g.search_repositories('', language='c#', sort="stars", order="desc"):
# 设置成50000的时候结果吓哭我了 最少的行数是15万行
if repo.size > 500:
continue
if len(repo_number) > 500:
break
repo_number[repo.html_url + '.git'] = 0
time.sleep(2)
for repo in repo_number:
number = getoutput(
"/usr/bin/git clone --depth 1 {} temp-linecount-repo &&/usr/bin/cloc temp-linecount-repo | tail -n2 | head -n1".format(
repo))
number = number.split()[-1].strip()
number = int(number) if number.isdigit() else 0
repo_number[repo] = number
try:
shutil.rmtree('temp-linecount-repo')
except FileNotFoundError:
pass
for i in sorted(repo_number.items(), key=lambda x: x[1]):
if i[1] == 0:
continue
print(i[0], i[1])
https://github.com/staffantan/unityglitch.git 44
https://github.com/mikelovesrobots/unity3d-console.git 187
https://github.com/Busta117/SQLiteUnityKit.git 249
https://github.com/wolfgarbe/symspell.git 268
https://github.com/oduslabs/ConsoleKit.git 311
https://github.com/github/GitPad.git 315
https://github.com/mikehadlow/AsmSpy.git 370
https://github.com/Chman/SMAA-Unity.git 394
https://github.com/EricFreeman/fuck.git 416
https://github.com/SirCmpwn/bf-irc-bot.git 453
https://github.com/InspectorIT/MongoDB.AspNet.Identity.git 491
https://github.com/UnityPatterns/ObjectPool.git 550
https://github.com/handcircus/Unity-Resource-Checker.git 641
https://github.com/robertcupisz/LightShafts.git 795
https://github.com/madskristensen/ShortcutExporter.git 823
https://github.com/atemerev/skynet.git 957
https://github.com/lei-zhu/SimpleCrawler.git 1013
https://github.com/thefuntastic/Unity3d-Finite-State-Machine.git 1132
https://github.com/jbogard/EntityFramework.Filters.git 1199
https://github.com/edumbill/doap.git 1223
https://github.com/VerbalExpressions/CSharpVerbalExpressions.git 1370
https://github.com/Chman/Moments.git 1379
https://github.com/NetEase/UnitySocketIO.git 1423
https://github.com/rogeralsing/Microphone.git 1445
https://github.com/cypherkey/RaspberryPi.Net.git 1567
https://github.com/Readify/GitViz.git 1756
https://github.com/andyburke/UnityHTTP.git 1761
https://github.com/Codeusa/SteamCleaner.git 1824
https://github.com/codebude/QRCoder.git 1982
https://github.com/sdrapkin/SecurityDriven.Inferno.git 2082
https://github.com/dcariola/XCodeEditor-for-Unity.git 2225
https://github.com/moserware/AES-Illustrated.git 2330
https://github.com/prime31/TouchKit.git 2403
https://github.com/imkira/unity-sysfont.git 2472
https://github.com/ulex/ZenSharp.git 2567
https://github.com/VioletGiraffe/cppcheck-vs-addin.git 2830
https://github.com/Lone-Coder/letsencrypt-win-simple.git 3017
https://github.com/ahmetalpbalkan/Docker.DotNet.git 3048
https://github.com/ihaoqihao/FastSocket.Net.git 3354
https://github.com/dotMorten/WindowsStateTriggers.git 3362
https://github.com/WebAssembly/ilwasm.git 3690
https://github.com/jcachat/EntityFramework.DynamicFilters.git 3973
https://github.com/barrett777/Heroes.ReplayParser.git 4250
https://github.com/prime31/GoKit.git 5427
https://github.com/petabridge/NBench.git 5534
https://github.com/StackExchange/NetGain.git 5674
https://github.com/docopt/docopt.net.git 6203
https://github.com/stackia/DNSAgent.git 10593
https://github.com/stramit/SSE.git 11701
https://github.com/google/sandbox-attacksurface-analysis-tools.git 12655
https://github.com/fpanettieri/unity-socket.io.git 13450
https://github.com/Microsoft/Microsoft.IO.RecyclableMemoryStream.git 13519
https://github.com/paf31/initialround.git 16225
https://github.com/gregoryyoung/m-r.git 19359
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment