7
votes
Accepted
Bash script to check available name in Github
The code is nice and short, and it is easy to read.
I'm surprised that it works at all. Sending the out=$(…) command to the background sounds as if the code might ...
6
votes
Upload a directory, in parallel, to an artifact repository
I think you'll find that inotify has problems of its own and that you're already on the right path.
The approach I'd use: get this working the way you want, then run it in a loop while your wget ...
6
votes
Accepted
Download stock data from YFinance
Enable all compiler warnings
This saves you and others time.
warning: implicit declaration of function 'strptime'; did you mean 'strftime'? [-Wimplicit-function-declaration]
warning: comparison ...
5
votes
Download stock data from YFinance
The code leaks memory. asprintf allocates memory. You need to free(res) before returning from ...
5
votes
Accepted
Small HTTP client/SDK created using libcurl in C language
Memory Leak:
s->ptr = realloc(s->ptr, new_len + 1);
If realloc() returned NULL, we'd ...
3
votes
Script that uses an uploaded excel file to import data to the database
Some quick comments:
The function checkURL is called in a loop, but inside that function you close the Curl connection every time. Instead you could speed up ...
3
votes
Extract data from api using shell scripting
Improve the validation of command line arguments
The condition means "the first argument is not empty",
but the comment says something else, which is confusing:
...
3
votes
Accepted
Bash script to automatically test Artifactory access
Looks OK. I only have four suggestions:
Use printf rather than echo. See Why is printf better than echo?
Put the URL at the ...
3
votes
Curl-based REST Client Library (round 3)
Review
Just as is the case with the code in rounds one and two, this code looks very thorough, easy-to-read, well-tested and well-documented. There aren't many suggestions I have to offer but please ...
3
votes
Curl-based REST client library (round 2)
It appears that much of the advice from Greg's answer and Peter's answer to your first post have been incorporated. I like the extensive use of docblocks throughout the code. There are a few ...
3
votes
Accepted
Refactoring with many duplicates using Bash
Use a function with a parameter for the variable part to eliminate duplication:
...
3
votes
Accepted
Refactoring a class that counts xml dom nodes and caches the result
the str_replace() calls can be consolidated. (Demo)
...
3
votes
Code to fetch BitBucket repos
eval is evil
Always look for ways to avoid eval.
Relevant snippet from the posted code:
...
3
votes
3
votes
Fetch a Quranic Verse from the Web
General Observations
There are definitely some good points to this code, for example rather than write your own code to do the curl functions or the JSON manipulation you used libraries. That is ...
3
votes
Accepted
Fetch a Quranic Verse from the Web
Just a strtoi() review.
Bug: errno setting/restoration woes.
errno = 0; should be done ...
2
votes
Accepted
Wrapper class for calling external API
First of all, it's a job for at least three separate functions (that should
belong to the different classes at best, but that would be a different story), each throwing its own exceptions.
...
2
votes
Accepted
Retrying Curl X amounts of Time until Successful Return (Script/Functions)
You can put your logic in a while loop that repeats indefinitely (we'll break out of it later). In that loop make your HTTP request and parse the response. If it is ...
2
votes
PasteBin API scraper for new public pastes that appear at regular intervals
There is no need to initialize an array to an empty list
when declaring the variable:
my @flaggedRegex = ();
This is simpler and cleaner:
...
2
votes
Laravel voting system
The Question
Could anyone advise a better way to create [cookies]?
Like your code already uses, setcookie() is the traditional way of setting cookies. And yes, ...
2
votes
Download stock data from YFinance
WriteData() should have static linkage:
As the function is only used in this translation unit, it should be declared with having ...
2
votes
A wrapper for user authentication using cURL in PHP
Let me be frank: this code is just a Frankenstein sewn from different unrelated parts. Basically here are two main problems:
sending HTTP requests is a distinct task and should be performed by ...
2
votes
Accepted
Checking for duplicate email in api response data
The for loop is not going to be the bottleneck in your loop, but what seems obvious to me is that you don't benefit from counting higher than ...
2
votes
Accepted
Shell script to download Project Euler problems and combine to PDF
Here's a refactoring with various fixes.
Generally quote shell variables.
Don't read lines with for.
I switched the URL ...
2
votes
Automatic notification system about changes to court cases
Tip: reusing the curl handle keeps the connection to the server open. Since you are marking repeated request against the same host, this should speed up things. Use ...
2
votes
Pay with PayPal through cURL and verify
Main Question
I haven't really used the Paypal API though I have reviewed other code using it including this project using the Laravel framework.
Should I compare value of "Price value that ...
1
vote
Extract data from api using shell scripting
@janos has already given great feedback that covers basically everything I would say and more when it comes to the shell script. I'd only add suggestions to factor out the error exits into a function (...
1
vote
Accepted
Instagram Basic Display API Full Example PHP
Overall feedback
It might be wise to put all the functions and constants into a class for the sake of encapsulation. That way the constants can be namespaced. Perhaps it would be wise to have a ...
1
vote
Accepted
Parallel download of rpm packages
I completely changed the approach which resulted in faster downloads, and improved functionality. The overall approach of the initial version works well for a generic solution looking for adding ...
1
vote
Upload a directory, in parallel, to an artifact repository
Here is the final result. It doesn't handle failure/retry as I continued to have issues with using a FIFO, but it does do a pretty good job. I ended up using ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
curl × 76php × 33
c++ × 14
bash × 13
performance × 10
c × 8
http × 8
json × 6
web-scraping × 5
api × 5
ruby × 4
multithreading × 4
mysql × 4
security × 4
email × 4
c++11 × 3
c++14 × 3
xml × 3
networking × 3
rest × 3
phpunit × 3
python × 2
javascript × 2
beginner × 2
object-oriented × 2