23
votes
Accepted
File Automation Using Python On Linux
Addressing your questions:
Readability
The docstrings are generally fine. Not too long, not too short.
Type hints:
Your type hints should not go into the first line of the docstring. That line is ...
18
votes
Accepted
18
votes
Accepted
C++ Linux TCP client/server socket wrapper
Design
This is a very thin C like wrapper around sockets. In my opinion there are a lot of style changes that are need to make this good C++ or usable by modern C++ library.
Main issues:
Two phase ...
18
votes
Tic-Tac-Toe for the terminal
First of all: nice work! It's easy to read and understand.
Program organization
It's very good that you split the task to small functions.
Reading the body of main...
17
votes
Accepted
Linux Commands in Python
Here are a few comments. In general, your code deviates in surprising ways from the UNIX commands (and not just by missing flags or options):
Your ls command does ...
16
votes
Accepted
Light task-processing systems with zero dependency for Linux systems
It's a good idea for worker.c to include "worker.h", preferably as the very first line. That ensures that the declarations are ...
15
votes
malloc() and free() for Linux with system calls
Names beginning with _ are reserved for the implementation; I'm surprised that -Wpedantic doesn't help with this!
Include what ...
13
votes
Light task-processing systems with zero dependency for Linux systems
Make sure Doxygen picks up comments after struct members
It's good to add a comment after each member in a struct declaration to describe what that member does. To make Doxygen pick up the member ...
13
votes
Accepted
Bash script to automate dev environment setup
I think you could benefit from using Ansible in this scenario then you can easily deploy your configuration to other machines and you will have learned a valuable IT skill.
And rather than use bash ...
12
votes
Reporting new USB storage devices on Linux and macOS with Python
This script might get the job done, but it is a rather crude and inefficient hack. Ideally, you should avoid polling every quarter second (or polling at all). Also, I see no reason to write any ...
12
votes
Bash script to automate dev environment setup
First of all, I would suggest using shellcheck when writing bash https://www.shellcheck.net/, it will point out many many errors, some trivial and some not so trivial.
...
12
votes
Securing my password wallet
Avoid calling system()
If possible, avoid calling system(). There are almost always issues doing this:
It is slow: ...
11
votes
Accepted
Parsing the lsblk output
lsblk
The -s option to lsblk was introduced to util-linux rather recently, in release 2.22. You may experience compatibility ...
11
votes
Accepted
C program for 'Reverse DNS lookup'
It's generally best to divide your code into separate sections (possibly separate functions) for argument handling and actual computation.
Errors should be printed to standard error rather than ...
10
votes
Removing multiple slashes from path
Here are some suggestions for how you might improve your code.
Use the appropriate #includes
This program fragment requires headers, which should be included:
<...
10
votes
Accepted
Linux screen dimmer based on battery level
Let's start with the obvious, coding best practices:
You should strive to make variable names easy to remember and meaningful. I think you could improve a bit on this, e.g. ...
10
votes
Accepted
Implementation of Linux cp in modern C++
I see some things that may help you improve your code.
Fix the bug
The program loops infinitely (actually, as @CrisLuengo correctly points out in a comment, it's not actually infinite. However, it ...
10
votes
C program for 'Reverse DNS lookup'
Use getaddrinfo()
getnameinfo() has a counterpart: getaddrinfo(). Prefer to use that ...
10
votes
Wi-fi scheduler written in C
I will offer some suggestions.
Please note I have no experience with Mac OS, but I believe most of it will still apply.
Using system is not particularly bad in ...
10
votes
Accepted
Securing my password wallet
There's quite a few beginner problems here:
using namespace std;
This is a really bad idea. It means we no longer have any control over the names in the global ...
9
votes
Removing multiple slashes from path
Your specification has holes in it.
What will be if user passes NULL? Undefined behavior? Return?
What if the path is already valid? Copy the string? Return ...
9
votes
Accepted
NASM tutorial (Linux syscalls, 64 bit) code with CI-build and test
When the function has finished it's logic, these registers should have their previous values
The normal x86-64 System V calling convention allows functions to clobber RAX, RCX, RDX, RSI, RDI, and R8-...
9
votes
Accepted
Bash script to truncate subject line of incoming email
Be sure to read the relevant RFCs that govern e-mail headers! Specifically:
RFC 2822, Section 1.2.2: Header names are case-insensitive.
RFC 2822, Section 2.2.3: Header fields may be line-folded:
2....
9
votes
Tic-Tac-Toe for the terminal
There's two things I'd change to simplify your code:
Use a two dimensional array. Sure you can do the conversion from a 2d position to 1d easily, but the compiler can do and ...
8
votes
My own little memory manager in C
You should separate your declarations into three parts:
The public interface. malloc calloc ...
8
votes
Accepted
Basic shell in C
Avoid a hacker exploit:
What happens when the first character read is a null character?
...
8
votes
Connect 4 in C++
Assuming you'll fix your bug.
Let's analyze your code.
#include <iostream>
#include <cstdlib>
#include <unistd.h>
I notice you've tagged your ...
8
votes
Accepted
Connect 4 in C++
This is an excellent start for a starting programmer.
There are many things to comment on, of course. I'm going to focus on what I think is most important for a new programmer to work on.
Compiler ...
8
votes
Accepted
Bash script to temporarily run a shell without certain group memberships
It's not an error to ask for help
When -h is passed, the help() function shouldn't exit with non-zero status, because it's done ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
linux × 561bash × 194
c × 138
shell × 82
python × 69
c++ × 52
beginner × 52
file-system × 44
sh × 38
installer × 34
posix × 33
performance × 32
assembly × 30
networking × 26
unix × 26
python-3.x × 20
parsing × 17
console × 17
security × 16
socket × 16
strings × 13
server × 13
child-process × 12
awk × 12
status-monitoring × 12