Linux is a free (libre), open source, Unix-like operating system.
-2
votes
0answers
24 views
PHP USB serial port call from Windows to Linux [on hold]
I have a piece of simple code that works on a Windows - WAMP environment, e.g.
...
4
votes
2answers
263 views
forever.sh - should keep a process alive forever
This script's only responsibility is to keep a process alive. Forever.
It's sole dependencies shall be bash and coreutils. I'm ...
-1
votes
0answers
25 views
Implementing DES algorithm in PHP on linux [closed]
I wrote this PHP script trying to implement DES algorithm.
I'm running it on terminal, not browser, with
php des.php AAAAAAAA AAAAAAAA
Here the script
...
4
votes
1answer
17 views
Shell Script Audio Logger
I created my first shell script. It's an audio logger that runs on the hour for an hour and restarts. Although if it is started within the hour it will only run until the end of the hour.
I've added ...
1
vote
0answers
34 views
Lock-free ordered singly linked-list behaves unpredictably [closed]
I wrote an algorithm for lock-free singly ordered list, that uses only one pointer mark to function - kind of novelty. However it behaves strangely, that is under more pressure > 20 threads it breaks, ...
3
votes
1answer
30 views
GRE Tunnel Script
I've made this script above for GRE Tunnels and I'd like to know how I can improve it.
Also, at the bottom, you'll see "Do you want to forward more ports." I want an easier method of asking this and ...
11
votes
1answer
60 views
Callback in Linux kernel driver in order to hide device's low-level protocol
I'm am writing a Linux kernel driver for HD44780 LCDs connected via I2C bus. In my last change I tried to decouple low-level code (which talks to the device via I2C) from device's logic (printing ...
2
votes
2answers
63 views
A basic C Shell for Linux
I have written a basic C Shell. It features the builtins cd, programmer, ver and ...
9
votes
3answers
493 views
Daemonizer in C
I am aware that the malloc is a potential memory leak, but with an execvp coming, and that never returning.
The purpose is to ...
6
votes
3answers
311 views
Locating a PID based on an IP address and port
I wrote a simple Python app that is given an IP address and port and the app then finds the PID listening on that IP:PORT.
I would like to hear constructive criticism regarding the bellow code.
...
7
votes
2answers
119 views
Backup Linux system to web
First I create a .tar of the root directory with all the file permissions saved and excluding all irrelevant directories (are these the right folders to be ...
3
votes
2answers
68 views
Assessment of client-server program source code
Can you assess source code of my client-server program?
I would like to get an advice about design, code security etc.
Thank you very much.
The program does the following:
Show files in ...
1
vote
0answers
15 views
Server framework
I decided to abstract out some of the code I use in personal projects into a library. In particular, it'd be used primarily for server-side programs, but I don't see any reason it wouldn't work fine ...
4
votes
2answers
112 views
Using sed regular expression to extract domain name from file
I'm learning regex with sed to extract the last field from file named "test". The method I'm trying gives desired output.
Please suggest if this method Im trying is ...
7
votes
1answer
67 views
Adding support to Busybox vi for reading file from stdin
I am writing a patch for Busybox's implementation of vi, the classical command line code editor and predecessor of vim. It can ...
3
votes
1answer
44 views
Remove line numbers from shell history
I want to parse Linux history output and the commands parts only (without numbers):
...
7
votes
1answer
57 views
Detecting two keys pressed in quick succession
My computer has been having this issue where when I press a key, two key presses get registered. The goal of this program is to detect the time delta between the two keys so that I can set an ...
4
votes
1answer
38 views
Ruby script that deletes servers from Red Hat Satellite
This script uses the Red Hat Satellite v5.4 API to delete servers which are read in from a file. The servers are listed in the file by hostname but the Satellite API deletes servers by ID number. The ...
1
vote
0answers
62 views
Defining a char device driver protocol over uart at kernel level
My aim is to write a blocking char driver that return to the user space a complete protocol message from the kernel uart driver.
Protocol description
I'm fighting with a very bad protocol, called ...
2
votes
2answers
73 views
Set-uid root program that runs a program as the user “restrict” (follow-up)
See Set-uid root program that runs a program as the user "restrict" for context.
I've written a very short program that is intended to run the program specified in its arguments (...
0
votes
1answer
29 views
Set-uid root program that runs a program as the user “restrict”
I've written a very short program that is intended to run the program specified in its arguments (argv) as the user named "restrict" (which exists). I want to make ...
4
votes
1answer
55 views
Remote control receiver for robot control
I have built an RC car and attached a Raspberry Pi to it - in order to control it, I wrote some Java code to listen to commands over the network and make the car move accordingly.
...
4
votes
2answers
50 views
Bash script to replace substrings in a file with strings
I am an editor of the Funtoo Linux wiki and was looking to create a shell script that would help to ease the updating of pages on the wiki that use old tags by replacing certain deprecated tags with ...
4
votes
2answers
52 views
Return from the parent process code or common code
In this program, the parent process creates a child process, then the child executes ls -l. The parent process waits for the child process to complete and then ...
4
votes
1answer
50 views
Restart Services Automatically
I have been working on a script that automatically checks on the state of 2 services that I require to be running 24/7 on a server that I manage.
The script works as I need, but I would really like ...
4
votes
2answers
81 views
Installing and removing kernel module RPMs
First, the script checks to see if it is installing two kernel module packages or removing them by looking at the first parameter. If no parameter is provided it complains and exits.
If installing, ...
3
votes
1answer
53 views
Append the first half of the first line of /etc/hosts to a conf file
I have to edit a config automatically before starting a service in a docker container (a storm supervisor), and I want to append something like this in ...
5
votes
1answer
181 views
Extracting emails from a file and writing them to another file
The code below works fine for me. Is there any way that I can improve this code more? Note: delimiter is single whitespace only for email address.
getmail.py
...
3
votes
2answers
30 views
Changing filename and copying in bash
I wrote a script which changes names of last downloaded songs and copy them to music directory. Can it be written better?
...
3
votes
1answer
42 views
Ordered doubly-linked lock-free list
I'm implementing a lock-free ordered doubly-linked list based on heavily modified paper entitled Split-Ordered Lists: Lock-Free Extensible Hash Tables by ORI SHALEV. My main concern is correctness of ...
1
vote
1answer
37 views
Alert on partition growth [closed]
I have a script that alerts me via email when a partition grows past a defined threshold in one hour. My script is run from cron hourly. Everything seems fine for 99% of the time, but occasionally I ...
1
vote
0answers
58 views
Writing binary data to file in Linux
I'm trying to learn C++ and I would interested in how I could write better code. The code should be independent of the architecture it is running on. What I want to do is writing some binary data to ...
4
votes
0answers
225 views
Probe request capturing with Scapy
This is a probe request packet sniffer using python/scapy. It sniffs Dot11ProbeReq packets and display the ssid, MAC of device and manufacturer name from the probe requests. Can also output the data ...
4
votes
3answers
80 views
Bash script that checks if font is installed and installs it if necessary
I'm new to writing bash scripts and I was wondering if I could get someone's advice on a part of the script I'm working on.
Intended purpose of code
Check if a font is installed by using ...
4
votes
1answer
118 views
A simple C++ trading system demo
I need my trading system demo reviewed. It implemented a simple system which parse the trading flow (logged in file) of different trader and calculate some important feature.
The code is listed here ...
2
votes
1answer
29 views
Bash script that checks for package dependencies and installs them if necessary
I'm new to Code Review and new to writing bash scripts as well. I was wondering if I could get someone's advice on a part of the script I'm working on.
Intended purpose of code
Check if a package ...
3
votes
1answer
65 views
Simple Linux pipeline
I've compiled a simple Linux pipeline and using my C style and modularization that I will use for my own operating system. Do you have something to say about this code (partly taken from SO)? For ...
1
vote
0answers
63 views
Local branch update script using Git and PHP
I'm using Git and PHP to create an update script which is sync local branch and the master. It checks about new updates, and if yes, it proceeds to the Git pull request and any response got from the ...
-6
votes
1answer
48 views
Reading temperatures from /sys
I have this code which is working fine but I would like to use Java 8 NIO in order to optimize the code performance.
...
3
votes
1answer
86 views
gcc installation script for Centos6.6
I have written this script to install gcc (here in version 4.9.2) on Centos6.6. I am only interested in C and C++ support.
Please comment if this is any good and can I make it better before I get the ...
4
votes
1answer
97 views
Multipurpose command-line utility to manage a web application
I'm creating a command-line tool which is supposed to work on both Windows and Linux OS. It will be used to manage our application - start, stop, deploy etc.
We have it in bash scripts now (and it ...
5
votes
1answer
36 views
Simple file locking wrapper command in C
A simple command that wraps another command, locking a file first. It is similar to flock, just simpler.
...
4
votes
2answers
399 views
Bash script to send emails when web server does not respond
I've made a simple bash script to check if a web server responds, and to send emails to a list of addresses if the website is down. Any suggestions as to how to improve it/ edge cases that I missed/ ...
3
votes
1answer
221 views
6
votes
1answer
332 views
Fast Thread- and multiprocess-safe file operations in python under Linux
I'm trying to implement an alternative to python built-in open(), but safe for use in multi-threaded and multiprocessing environment. I'm using advisory locking, ...
4
votes
1answer
53 views
Simplifying a Makefile
I have a makefile like the one below and I am trying to simplify it. I know I should be assigning variables to cut down on repeated things but I am still confused as to how to properly simplify this ...
4
votes
2answers
377 views
1
vote
2answers
43 views
Repeatedly fetching a URL until the response contains “state: INIT”
I am working on a project in which I need to make a URL call to one of my servers from a bash shell script.
http://hostname.domain.com:8080/beat
After hitting the above URL, I will be getting ...
5
votes
3answers
102 views
Check disk space against a threshold
The below script is one I made to check the disk space on mounted partitions under Debian Wheezy. I tried adding a -d switch to force printing out the used data, ...
3
votes
2answers
104 views
Number of files with specific file size ranges
I am trying to write a script that will traverse through my directory and sub directory and list the number of files in a specific size.
For example, 0kb-1kb: 3, 1kb-4kb:4, 4-16KB: 4, 16kb-64-kb:11. ...