Linux is a Free (libre), Open Source, Unix-like operating system.

learn more… | top users | synonyms

1
vote
2answers
25 views

Small bash script to start and stop named services

I've been working on ubuntu since many years but not quite familiar with bash scripting. My development tools involve servers like nginx and apache, the mysql database and beanstalkd. Obviously, I ...
4
votes
1answer
18 views

Generic Makefile

I decided to setup a generic makefile to compile SFML programs, as I'm going to be making a bunch of small apps over the next few weeks playing around with it. I'm still new to writing makefiles ...
8
votes
1answer
164 views

VLC media player watchdog daemon

I'm looking for bugs, ways to make it more portable or standardized, improvements of any kind. Seems to do what it is supposed to on my Ubuntu 12.04 PC. ...
5
votes
2answers
66 views

Benchmarking our LAMP servers with this php script

I've written a small script to benchmark our LAMP hosted servers that assess the performance based on three factors: Disk I/O Database I/O (mysql) Database I/O (sqlite) The logic is as follows: ...
3
votes
1answer
83 views

Converting from std::wstring to std::string in Linux

I was bothered by inability of C++ to mix cout and wcout in the same program - so I've found this question: Converting between ...
2
votes
1answer
29 views

Optimizing string replacement program that uses recursion

I have the following string replacement program for a string of size 256: I am replacing the string "\'" with the string ' Please suggest any modifications if needed or any ...
2
votes
1answer
23 views

IPtables for webserver with ssh

I've had a bit of help but I'm still a bit unsure. I have an nginx webserver with SSH only required. I wrote this rule set based on information I found on the internet: ...
8
votes
3answers
241 views

Bash script that updates Intel e1000e driver

I am now writing a small bash script that updates an Intel NIC driver to the latest version from the official website. Is there any way to improve\simplify the script? I want to avoid a lot of ...
3
votes
0answers
107 views

Is there a better way to copy into two different folders on a machine simultaneously?

I am trying to copy files from machineB and machineC into machineA as I am running my below ...
0
votes
0answers
44 views

Script to configure accounts, SSHD, and firewall [closed]

In terms of general security, am I doing anything wrong in this script? ...
3
votes
0answers
73 views

How to copy files as fast as possible?

I am running my shell script on machineA which copies the files from machineB and machineC ...
3
votes
1answer
424 views

Moving and organizing files in download folder

This is a Python script that I use on my Android tablet. It moves the files in the Download folder to a folder on the external SD card. The files are sorted based ...
11
votes
1answer
194 views

Linux NASM assembly linked list implementation

Inspired by all of the lovely linked lists lately, I decided to implement one in assembly language. This code maintains two linked lists - one is a free store and the other is the active linked list. ...
5
votes
2answers
349 views

Abstraction for an IO device

I have a C++ class which acts as an abstraction for an IO device which is controlled through file descriptors. As I am very new to C++, I would be glad if you can give me devastating feedback on ...
2
votes
0answers
97 views

Script for obtaining images from an IP security camera

I am fairly new to Python and programming in general so I hope the code in this post is not too messy. I have the following code which I use for taking images from an IP security camera: ...
16
votes
4answers
887 views

Recording audio in C

This is a program I wrote as a .wav audio recording library for Linux. It was developed on a Raspberry Pi, so that may affect the dependencies required.(1) Here ...
10
votes
1answer
123 views

Set of wrapper functions for POSIX signal APIs on Linux

Please feel free to comment on the accuracy/validity of the following wrapper source for processing signals using the new POSIX sigaction API. If you feel I'm doing anything wrong or potentially ...
4
votes
2answers
62 views

Packaging a single-file Python copy-tool

I'm currently working on a very simple one-file project: Lumix provides the possibility for the camera TZ41 (and others) to load GPS data and tourist information from a DVD to a SD-card so that you ...
3
votes
1answer
84 views

Ping Pong Pi - A ping pong score and serving manager

I have spent a few hours on this code, but think it could be improved a bit. It requires eSpeak to be installed to run the speech synthesis, but the voice can be toggled on or off using the ...
5
votes
2answers
70 views

VLC media player watchdog daemon v6

This question is a follow-up to a previous version of this program, which I wrote because I found it annoying that VLC Media Player (which I love) prevents the screensaver from starting after playback ...
7
votes
3answers
145 views

Iptables Lockdown

I have nginx serving files with uwsgi and I wanted to lock my server down just to allow SSH and Nginx to run. This is what I have: ...
6
votes
1answer
154 views

Push backup script

I just wrote a little bash script for rsync push backups of my laptop to my Synology-Diskstation at home. Since I am a bash beginner and don't have any experience with ...
10
votes
2answers
199 views

x64 assembly clearmem / zeromem

I've just started learning assembly yesterday, and the first useful thing I've written is a clearmem function. I'm looking for general feedback regarding my coding ...
7
votes
1answer
289 views

Writing SIMD libraries for C++ on FASM in x86-64 Linux

I have recently started a project of SIMD libraries development for C++ on FASM for x86-64 Linux. I would be glad to hear any opinion or feedback about the project, cleanness of the code and ...
5
votes
2answers
626 views

TCP socket server for UNIX

I'm very new to C++, but I really want to write good code and increase my development skill, so I ask you for some review. Scheme of socket server This is the scheme of how my socket server works. ...
5
votes
1answer
229 views

First steps with amd64 assembly

I try to learn amd64 assembler. This is the first thing I tried. This piece of assembly should replicate the functionality of the following piece of C code, which turns a binary sha-256 hash into a ...
3
votes
1answer
198 views

Parsing hex and decimal numbers in C++11

The function arg_to_uint64 takes a 0-terminated string and returns an unsigned int. The ...
2
votes
1answer
171 views

Automate a dependency graph with parallel programming [closed]

I found a C/Linux exercise in a book, and I propose a code as a solution, please feel free to correct it. Here is the exercise : Taking into consideration the following dependency graph, which ...
5
votes
4answers
3k views

Linux C++ Timer Class: How can I improve the accuracy?

I wrote this class today, but I am trying to figure out how to make it more accurate. I pass in seconds and multiply by 1000 to make it milliseconds, and the time does not line up. I need the ability ...
7
votes
1answer
111 views

Bash script - automate an upload image + description process on a server

I was tasked at work to improve a system where through a web interface a client, which eventually became us, uploads a bunch of images with descriptions (latter coming from csv files), the images are ...
13
votes
1answer
127 views

Regular backup/snapshots

A (long) while ago I set up a file server in my basement running Linux. I am OCD when it comes to backups. I set the server up with (remember, this was a while ago): disk for OS disk for 'valuable' ...
2
votes
0answers
93 views

How to design a robust class for Packet Capturing tool? [closed]

I need to design a class for packet capture tool. Class should provide service to start and stop a dumpcap packet capture. Class should be capable of accepting all sorts of inputs which includes ...
5
votes
2answers
651 views

Running a shell command and getting output

This is the code I'm currently using to run a shell command on the current machine, intended for use only with GNU/Linux at the moment: ...
6
votes
3answers
407 views

x86 strcpy - can this be shortened?

I got about 4 days of assembly knowledge so, I need a review on this strcpy function and if it can be done better (At least I have the feeling). Full code (with the test included): ...
1
vote
1answer
134 views

Interactive menu system in Bash [closed]

This is a simple loop menu script that I have for class. The goal was to make a menu with applicable commands. Menu: A. Greet me. (Greet the user by their username (using the whoami ...
2
votes
0answers
50 views

Synchronize 3 processes with fork() [closed]

I was given the following exercise in my university: Given 3 processes: d1 - print("I"), print("D") d2 - ...
6
votes
1answer
209 views

Calculate query coverage from BLAST output

I have a BLAST output file and want to calculate query coverage, appending the query lengths as an additional column to the output. Let's say I have 2 7 15 ...
7
votes
2answers
122 views

Self-mutating C (x86_64)

As a learning exercise I wrote a short C program that changes the instructions of a function at runtime in order to execute a shell. It's obviously dependent on x86_64 architecture and Linux (for the ...
6
votes
1answer
221 views

Correctness of calculations with struct timespec

I've noticed some discrepancies in timings in our system, and I'm trying to narrow down what could be causing them. I'm reviewing out time abstraction, and as far as I can determine it's fine. Am I ...
2
votes
0answers
120 views

Directory's disk usage list

For my classes, I had to finish this task: Directory's disk usage list For indicated directory print a list of files and subdirectories in descending order according to their total disk ...
4
votes
4answers
193 views

Improving C file reading function

I am programing in C language and have created the below functions to read files. There are two functions that I can use to read files. I wanted to know how I can further improve these two in terms of ...
2
votes
1answer
860 views

mutex and condition variable implementation using futex

I have implemented mutex and contition variables using futex syscall. I believe that my implementation is correct, but would like it to be verified by some one else. If some of you could verify its ...
6
votes
2answers
105 views

Batch rename flac files

This is my first real program in python (and my first real program) and I would like to have input by some more advanced programmers on the code, on the writing style and on the amount of comments (is ...
3
votes
1answer
339 views

Object-oriented Linux networking library

I needed to perform network communications in my Linux C++ project. I thought that it was a good idea to operate on a higher level of abstraction than raw system calls. Also I love OO design. So I'm ...
0
votes
2answers
67 views

Optimize this path location script?

Example Script is located in /home/insp/public_html/deploy/ I want to return the /home/insp/ section ...
4
votes
4answers
67 views

apt alternative for proxy environment with bash shell

As I am new to bash scripting, and want to use apt-get in my university. I know that many people have issues when trying to do so. My focus is simplicity and ease of use, but still need to be ...
-2
votes
1answer
42 views

Listing daemons from Linux [closed]

I have this code that lists daemons from Linux. I use /proc filesystem to get the data that I want to read: This is the file structure: ...
2
votes
2answers
370 views

Reference counted dynamic byte array

What? I have a reference counted dynamic byte array written in C. I'm currently using this implementation in a FIFO fashion. Particularly reading data from files into the arrays, then parsing the ...
2
votes
1answer
199 views

Bash to find all placeholder variables in a file and replace will real variables

I am looking to make a generic config file using variables such as: $PLACEHOLDER_USER Then after moving the file into the correct position I want to replace every instance of *$PLACEHOLDER_VARIABLE* ...