Skip to content

Instantly share code, notes, and snippets.

@petertseng
Last active March 5, 2018 11:22
Show Gist options
  • Save petertseng/1f3542ade22d5b210c0b to your computer and use it in GitHub Desktop.
Save petertseng/1f3542ade22d5b210c0b to your computer and use it in GitHub Desktop.
Advent of Code language counts
#Total at 161201 2696
Python 638
Javascript 270
Java 206
Ruby 206
C# 158
Haskell 116
Go 101
C++ 86
PHP 85
Rust 85
Scala 73
Clojure 68
Elixir 68
C 40
Swift 40
HTML 35
F# 35
Kotlin 32
Perl 29
Shell 16
Erlang 15
Jupyter Notebook 12
CoffeeScript 8
Groovy 8
Racket 7
Dart 6
Common Lisp 5
Lua 5
Powershell 5
D 4
Julia 4
OCaml 4
Perl6 4
R 4
Crystal 3
TypeScript 3
J 2
Nimrod 2
Objective C 2
Groff 2
Haxe 2
Ada 1
Assembly 1
Brainfuck 1
Ceylon 1
Cucumber 1
Elm 1
Emacs Lisp 1
LiveScript 1
Moonscript 1
OpenEdge ABL 1
Pike 1
Prolog 1
PureScript 1
Scheme 1
Visual Basic 1
# Excluded a CSS since it's just a calendar, not code.
query: advent code created:2016-12-01..2017-10-31 NOT adventure
total 3018
Python 735
JavaScript 308
Java 251
C# 202
Ruby 173
Haskell 116
Rust 114
C++ 111
Elixir 91
Go 91
Clojure 79
PHP 62
Kotlin 50
Scala 49
Swift 48
F# 42
C 40
HTML 31
Jupyter Notebook 31
TypeScript 21
Perl 19
Powershell 16
Erlang 14
Elm 10
Groovy 10
Common Lisp 6
OCaml 7
R 6
Julia 5
Shell 5
Dart 4
Perl 6 4
Idris 3
Lua 3
Matlab 3
OpenEdge ABL 3
Pony 3
Visual Basic 3
Assembly 2
CoffeeScript 2
Crystal 2
PureScript 2
XSLT 2
ActionScript 1
Ada 1
Awk 1
Brainfuck 1
ColdFusion 1
D 1
Forth 1
Haxe 1
Io 1
LOLCODE 1
NewLisp 1
Nit 1
Objective C 1
PLpgSQL 1
Prolog 1
Rebol 1
Scheme 1
Standard ML 1
Tcl 1
query: advent code created:2017-12-01..2017-12-31 NOT adventure
total 6442
Python 1548
JavaScript 705
Java 440
C# 385
Rust 355
Go 294
Ruby 277
Haskell 244
C++ 213
Kotlin 181
Elixir 179
Clojure 169
Jupyter Notebook 125
Scala 117
PHP 108
C 89
F# 71
Swift 68
TypeScript 53
HTML 40
OCaml 36
Powershell 25
R 24
Elm 22
Lua 22
Racket 19
Perl 18
Common Lisp 15
D 11
Groovy 11
Nim 11
Crystal 10
Erlang 10
CoffeeScript 8
PureScript 8
Shell 8
Emacs Lisp 7
Julia 7
Scheme 7
Perl 6 6
Dart 5
Pony 5
Visual Basic 5
Matlab 4
APL 3
Idris 3
Makefile 3
Mathematica 3
Prolog 3
ABAP 2
Apex 2
Assembly 2
Awk 2
COBOL 2
CSS 2
J 2
OpenEdge ABL 2
Pascal 2
PLpgSQL 2
Smalltalk 2
Standard ML 2
XSLT 2
Ada 1
ATS 1
Batchfile 1
CMake 1
ColdFusion 1
Eiffel 1
Factor 1
Forth 1
Fortran 1
Haxe 1
Limbo 1
Nix 1
Objective C 1
Processing 1
SourcePawn 1
SQLPL 1
Tcl 1
Verilog 1
Vue 1
lines = ARGF.readlines
puts lines.drop_while { |l|
# Using ?# causes misindenting.
l[0] == '#' || l.start_with?('query: ') || l.start_with?('total ')
}.map(&:split).map { |words|
'-language:' + words[0...-1].join(?-)
}.join(' ')
require 'cgi'
lines = ARGF.readlines
query = lines.find { |l| l.start_with?('query: ') }.split(?:, 2).last.chomp
lines.each { |l|
# Using ?# causes misindenting.
next if l[0] == '#' || l.start_with?('query: ') || l.start_with?('total ')
language = l.split[0...-1].join(?-)
lang_query = "#{query} language:#{language}"
puts "https://github.com/search?q=#{CGI.escape(lang_query)}&type=Repositories"
}
freq = Hash.new { |h, k| h[k] = [0] * ARGV.size }
ARGV.each_with_index { |f, i|
lines = File.readlines(f)
lines.drop_while { |l|
# Using ?# causes misindenting.
l[0] == '#' || l.start_with?('query: ') || l.start_with?('total ')
}.map(&:split).each { |words|
lang = words[0...-1].join(' ')
freq[lang][i] = words[-1].to_i
}
}
maxname = freq.keys.max_by(&:size).size
freq.sort_by { |k, v| [-v.max, k] }.take_while { |_, v| v.max > 1 }.each { |name, freqs|
nums = (' %3d' * ARGV.size) % freqs
puts "%#{maxname}s%s" % [name, nums]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment