Skip to main content
Share Your Experience: Take the 2024 Developer Survey
52 votes

Send a tweet to ISP when internet speed drops

Overall this is quite a nice module. Here are a few usability issues/nitpicks, though: When running the script, there is no easy way to stop it. CTRL+C does not work, I have to manually kill the ...
Graipher's user avatar
  • 41k
37 votes

Send a tweet to ISP when internet speed drops

This is more of a design / algorithm / architecture review than of the code. There are some major issues the other answers didn't address. First of all, wasting network bandwidth running a speed-...
Peter Cordes's user avatar
  • 3,346
25 votes

Send a tweet to ISP when internet speed drops

I'd like to say just one (yet IMO very important) thing: You're developing bad habits early! The point of classes is to eliminate (truly) global state and to ...
Grajdeanu Alex's user avatar
8 votes

Send a tweet to ISP when internet speed drops

I think you need to think your use cases through a bit. What should this do during an outage? Do you want to enqueue a new tweet if a previous one hasn't been sent yet? Do you want to enqueue a ...
SQB's user avatar
  • 226
8 votes

Loop to print changes in irrigation state to turn on and off a pump when water is low

Just curious, but have you checked CPU usage ? Programs that run in a while loop can be terribly inefficient and taxing. Here you are just probing a sensor, this does not look like a computationally-...
Kate's user avatar
  • 6,753
7 votes

Laptop battery level monitor for Linux

You could replace your get_str_from_file function with the standard read_to_string function: For instance like so: ...
Oliver's user avatar
  • 171
6 votes
Accepted

NRPE script for monitoring load average

This looks pretty good. Some suggestions: [[ is preferred over [ in Bash. This script could benefit from ...
l0b0's user avatar
  • 8,927
6 votes

Loop to print changes in irrigation state to turn on and off a pump when water is low

If I understand what you are trying to do, I think you can (1) remember the prior state, (2) print only on changes, and (3) select the message to print based on the new state. ...
FMc's user avatar
  • 12.7k
5 votes
Accepted

CPU core temperature Unity indicator

This definitely looks like a real project that someone can use or expand. Have you put it on GitHub? The symbolic constants defined in TempI.h are following the C Standard. Some general ...
pacmaninbw's user avatar
  • 23.8k
5 votes

Thread to send heartbeat UDP packets

Overall - good initial post. Recommend to include the corresponding header file first. If heartbeat.h relies on any include file, then it (the .h file) should ...
chux - Reinstate Monica's user avatar
5 votes

Remotely collect server data using Net::OpenSSH

Looks good to me. Kudos for the "... or die" idiom. More informative output would be "unable to run df on $s" or "unable to run svmon on $s". You don't have to do ...
J_H's user avatar
  • 27.5k
5 votes
Accepted

C# classes for system health metrics

A design pattern often used, is to have a non generic base type and a generic type derived from it or a type implementing a non generic as well as a generic interface. An example is ...
Olivier Jacot-Descombes's user avatar
5 votes

Log monitoring with pythonic tail -f and process killing

Using regex for such a simple task as finding if a line contains a string is not worth it. The built-in str.__contains__, being called by the keyword ...
Graipher's user avatar
  • 41k
5 votes

Python script for alerting disk usage and take action if needed

Overall not bad! You've managed to avoid many of the "usual suspects" when it comes to Python scripting practices. make_logger could use a return ...
Reinderien's user avatar
  • 62.1k
4 votes
Accepted

Check if the website is up

When the server does not exists it seems node throws an EIO error. Now you need to make a decision, you can either reject the promise or resolve with false. From ...
Bruno Costa's user avatar
  • 5,566
4 votes

BASH script to monitor subprocess and throttle it for CPU temperature control

Although unrelated to the code, I'll mention that for a CPU to overheat, especially a dual-core CPU, is not usual except with very high ambient temps. I'd suggest removing the heat sink and re-...
Oh My Goodness's user avatar
4 votes
Accepted

Nagios check to see if a certain IP appears in a trace route

Your use of $locate as a regular expression for grep is sloppy. If $locate is ...
200_success's user avatar
4 votes
Accepted

Laptop battery level monitor for Linux

Unwrapping options is probably fine for this simple little app that only you’re using, but it dumps out a panic if the result is None. I like your use of ...
RubberDuck's user avatar
  • 30.8k
4 votes

Express.js functions to start session, authenticate user, perform ping, search for user, reset password, and import product XML

The general rule is that you should never incorporate user-controlled input into a string that will be interpreted by a computer system without escaping it first. Specifically, at a quick glance, it'...
200_success's user avatar
4 votes
Accepted

Loop to print changes in irrigation state to turn on and off a pump when water is low

I agree with @Anonymous that you should not loop continuously like that, or you'll waste energy and CPU time continuously checking the values. To solve this you can just sleep, wake up every minute, ...
Francesco Pasa's user avatar
3 votes

Detecting UI thread hanging and logging stacktrace

Great idea! That makes it possible to get information about hanging / lacking GUIs. That kind of (probably) valuable information are only available via customer feedback otherwise :). It would be ...
JanDotNet's user avatar
  • 8,538
3 votes
Accepted

Multithreaded C program to calculate CPU usage of cgroups

Global Variables I see this comment just prior to the declarations for the global variables: //TODO: localize? My answer would be yes. It is very difficult to read,...
pacmaninbw's user avatar
  • 23.8k
3 votes

Nagios check to see if a certain IP appears in a trace route

Instead of storing the output of the traceroute | grep pipeline in a variable and checking that it's not empty, it would be better to work with the exit code of the ...
janos's user avatar
  • 111k
3 votes

Nagios check to see if a certain IP appears in a trace route

You need to quote your variables: traceResult=$(traceroute -n -w 2 "$target" | grep "$locate") ref: Security implications of forgetting to quote a variable in ...
glenn jackman's user avatar
3 votes

Nagios check to see if a certain IP appears in a trace route

As from your comment: Its a shared block used in other "nagios" scripts. ...
πάντα ῥεῖ's user avatar
3 votes

Process monitoring script

Don't write custom scripts for common sysadmin tasks. Using the proper tools will get the job done better, and the solution will be more maintainable — especially by any colleagues you might have. ...
200_success's user avatar
3 votes

Bash script to send notifications when low on ram

Kudos to you! This is a nice little script, easy to read and to understand. However, there is no reason to reach for expr. Most shells (including ...
Zeta's user avatar
  • 19.3k
3 votes

NRPE script for monitoring load average

I’d agree with all of l0b0’s answer – including the suggestion of using grep to process /proc/cpuinfo. An alternate way to count ...
Anthony Geoghegan's user avatar
3 votes

C# classes for system health metrics

I just have a couple of minor points to add to Olivier Jacot-Descombes' excellent answer. ...
Peter Taylor's user avatar
  • 24.1k
3 votes
Accepted

Python script for alerting disk usage and take action if needed

First, some minor issues: logger is a global variable, and all your functions are completely dependent on it being present -- and if you ...
Sara J's user avatar
  • 3,442

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