Comments (7)
It looks like this command can compute correct value:
awk 'END {print NR-1}' storage/{username}-views > storage/{username}-views-count
from github-profile-views-counter.
I believe wc -l
does not count the new line at the end of the file
$ echo -e "hello\nthere" > test.txt && wc -l test.txt
2 test.txt
from github-profile-views-counter.
Try
echo -e "hello\nthere\n" > test.txt && wc -l test.txt
from github-profile-views-counter.
That puts two new lines at the end of the file.
from github-profile-views-counter.
That's exactly how views are stored. We have a blank line on the end of the file.
from github-profile-views-counter.
Yes, but your example puts two blank lines at the end of the file.
from github-profile-views-counter.
Does the following script using Perl's readdir() for listing the directory content hang? It shouldn't try to read the entire directory content at once.
my $dir = "/app/storage";
opendir(my $dh, $dir) || die "Can't open $dir: $!";
while (my $f = readdir $dh) {
print "$dir/$f\n";
}
closedir $dh;
Save it as filename.pl
and run in the container it using:
perl filename.pl
If it doesn't we can build upon that.
If it hangs, we can consider fixing the user on each HTTP request. We can have a flag that determines if a certain username is fixed, and on each request we check if the flag exists. If it doesn't, we fix the user and create the flag.
from github-profile-views-counter.
Related Issues (20)
- Server error while trying to sign up HOT 2
- Attempting to use <div align="center"> seems to break it HOT 3
- How to set the initial value HOT 10
- Bug it counts everytime I reloads the page HOT 1
- Race condition vulnerability causes counter reset
- 500 SERVER ERROR HOT 7
- Free public hosting HOT 1
- [Feature suggestion] Timeline counter view HOT 1
- Condensed Counter View? HOT 7
- There occurs a problem with the display of the icon HOT 2
- View Count Icon is shrinked HOT 1
- Expand the container when the views exceed the 3-digit number HOT 2
- Only show other's view counts HOT 1
- How can you self-host it? HOT 2
- How to get the views of repository? HOT 1
- [Request] Exclude own profile visits in counter HOT 3
- Returning 503 Error for my profile HOT 1
- Button alignment HOT 2
- how does it work? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from github-profile-views-counter.