Skip to main content
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 ...
Roland Illig's user avatar
  • 21.9k
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 ...
Oh My Goodness's user avatar
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 ...
chux's user avatar
  • 36.4k
5 votes

Download stock data from YFinance

The code leaks memory. asprintf allocates memory. You need to free(res) before returning from ...
vnp's user avatar
  • 58.7k
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 ...
Madagascar's user avatar
  • 10.1k
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 ...
Kate's user avatar
  • 8,313
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: ...
janos's user avatar
  • 113k
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 ...
cas's user avatar
  • 234
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 ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
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 ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
3 votes
Accepted

Refactoring with many duplicates using Bash

Use a function with a parameter for the variable part to eliminate duplication: ...
janos's user avatar
  • 113k
3 votes
Accepted

Refactoring a class that counts xml dom nodes and caches the result

the str_replace() calls can be consolidated. (Demo) ...
mickmackusa's user avatar
  • 8,802
3 votes

Code to fetch BitBucket repos

eval is evil Always look for ways to avoid eval. Relevant snippet from the posted code: ...
janos's user avatar
  • 113k
3 votes

Optimize cURL requests to Google API

Url building ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
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 ...
pacmaninbw's user avatar
  • 26.1k
3 votes
Accepted

Fetch a Quranic Verse from the Web

Just a strtoi() review. Bug: errno setting/restoration woes. errno = 0; should be done ...
chux's user avatar
  • 36.4k
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. ...
Your Common Sense's user avatar
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 ...
John Conde's user avatar
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: ...
toolic's user avatar
  • 15.9k
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, ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
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 ...
Madagascar's user avatar
  • 10.1k
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 ...
Your Common Sense's user avatar
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 ...
mickmackusa's user avatar
  • 8,802
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 ...
tripleee's user avatar
  • 541
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 ...
Kate's user avatar
  • 8,313
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 ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
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 (...
ades's user avatar
  • 1,391
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 ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
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 ...
André Werlang's user avatar
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 ...
Christian Bongiorno's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible