mirror of
https://github.com/mgerb/top-of-reddit
synced 2026-03-05 12:55:28 +00:00
update go, add 2021 and 2022 lists
This commit is contained in:
45
src/Gopkg.lock
generated
45
src/Gopkg.lock
generated
@@ -1,45 +0,0 @@
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/boltdb/bolt"
|
||||
packages = ["."]
|
||||
revision = "2f1ce7a837dcb8da3ec595b1dac9d0632f0f99e8"
|
||||
version = "v1.3.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-runewidth"
|
||||
packages = ["."]
|
||||
revision = "9e777a8366cce605130a531d2cd6363d07ad7317"
|
||||
version = "v0.0.2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/olekukonko/tablewriter"
|
||||
packages = ["."]
|
||||
revision = "b8a9be070da40449e501c3c4730a889e42d87a9e"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/tidwall/gjson"
|
||||
packages = ["."]
|
||||
revision = "01f00f129617a6fe98941fb920d6c760241b54d2"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/tidwall/match"
|
||||
packages = ["."]
|
||||
revision = "1731857f09b1f38450e2c12409748407822dc6be"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "f6cff0780e542efa0c8e864dc8fa522808f6a598"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "410f2309734b7779e944fba4bbaf122a51c8a46123a5da4f3fd6d496824ebbe4"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
@@ -1,42 +0,0 @@
|
||||
# Gopkg.toml example
|
||||
#
|
||||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
|
||||
# for detailed Gopkg.toml documentation.
|
||||
#
|
||||
# required = ["github.com/user/thing/cmd/thing"]
|
||||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project"
|
||||
# version = "1.0.0"
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project2"
|
||||
# branch = "dev"
|
||||
# source = "github.com/myfork/project2"
|
||||
#
|
||||
# [[override]]
|
||||
# name = "github.com/x/y"
|
||||
# version = "2.4.0"
|
||||
#
|
||||
# [prune]
|
||||
# non-go = false
|
||||
# go-tests = true
|
||||
# unused-packages = true
|
||||
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/boltdb/bolt"
|
||||
version = "1.3.1"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/tidwall/gjson"
|
||||
version = "1.1.0"
|
||||
|
||||
[prune]
|
||||
go-tests = true
|
||||
unused-packages = true
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/olekukonko/tablewriter"
|
||||
15
src/go.mod
Normal file
15
src/go.mod
Normal file
@@ -0,0 +1,15 @@
|
||||
module github.com/mgerb/top-of-reddit
|
||||
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/boltdb/bolt v1.3.1
|
||||
github.com/olekukonko/tablewriter v0.0.0-20180130162743-b8a9be070da4
|
||||
github.com/tidwall/gjson v1.1.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/mattn/go-runewidth v0.0.2 // indirect
|
||||
github.com/tidwall/match v1.0.0 // indirect
|
||||
golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54 // indirect
|
||||
)
|
||||
12
src/go.sum
Normal file
12
src/go.sum
Normal file
@@ -0,0 +1,12 @@
|
||||
github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
|
||||
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
|
||||
github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o=
|
||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/olekukonko/tablewriter v0.0.0-20180130162743-b8a9be070da4 h1:Mm4XQCBICntJzH8fKglsRuEiFUJYnTnM4BBFvpP5BWs=
|
||||
github.com/olekukonko/tablewriter v0.0.0-20180130162743-b8a9be070da4/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||
github.com/tidwall/gjson v1.1.0 h1:/7OBSUzFP8NhuzLlHg0vETJrRL02C++0ql5uSY3DITs=
|
||||
github.com/tidwall/gjson v1.1.0/go.mod h1:c/nTNbUr0E0OrXEhq1pwa8iEgc2DOt4ZZqAt1HtCkPA=
|
||||
github.com/tidwall/match v1.0.0 h1:Ym1EcFkp+UQ4ptxfWlW+iMdq5cPH5nEuGzdf/Pb7VmI=
|
||||
github.com/tidwall/match v1.0.0/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
||||
golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54 h1:4qAtdeqGYyXU2CfUvLomEFw0cl5IxNxmEhXL52ODpiU=
|
||||
golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/mgerb/top-of-reddit/src/model"
|
||||
"github.com/mgerb/top-of-reddit/model"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
|
||||
@@ -6,9 +6,10 @@ import (
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mgerb/top-of-reddit/src/model"
|
||||
"github.com/mgerb/top-of-reddit/model"
|
||||
"github.com/olekukonko/tablewriter"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
@@ -116,11 +117,12 @@ func writeStatsToFile(posts []model.RedditPost) error {
|
||||
data := [][]string{}
|
||||
|
||||
for _, v := range countList {
|
||||
title := "[" + v[0].Title + "]" + "(https://www.reddit.com" + v[0].Permalink + ")"
|
||||
escapedTitle := strings.ReplaceAll(v[0].Title, "|", "\\|")
|
||||
title := "[" + escapedTitle + "]" + "(https://www.reddit.com" + v[0].Permalink + ")"
|
||||
data = append(data, []string{v[0].Subreddit, strconv.Itoa(len(v)), title, strconv.Itoa(v[0].Score)})
|
||||
}
|
||||
|
||||
file, _ := os.Create("counts.md")
|
||||
file, _ := os.Create("README.md")
|
||||
|
||||
table := tablewriter.NewWriter(file)
|
||||
table.SetAutoWrapText(false)
|
||||
|
||||
20
src/scripts/generate.sh
Executable file
20
src/scripts/generate.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
# get first argument
|
||||
if [ -z "$1" ]; then
|
||||
echo "Please provide a year e.g. 'generate.sh 2023'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
rm README.md subreddits.txt wordcloud_$1.png;
|
||||
|
||||
go run generate-stats.go $1;
|
||||
|
||||
wordcloud_cli \
|
||||
--text subreddits.txt \
|
||||
--imagefile wordcloud_$1.png \
|
||||
--color red \
|
||||
--background white \
|
||||
--height 2000 \
|
||||
--width 2000 \
|
||||
--margin 10 \
|
||||
--mask ./circle.png
|
||||
@@ -1,9 +0,0 @@
|
||||
wordcloud_cli \
|
||||
--text subreddits.txt \
|
||||
--imagefile output.png \
|
||||
--color red \
|
||||
--background white \
|
||||
--height 2000 \
|
||||
--width 2000 \
|
||||
--margin 10 \
|
||||
--mask ./circle.png
|
||||
Reference in New Issue
Block a user