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

learn more… | top users | synonyms

2
votes
0answers
56 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: ...
0
votes
0answers
11 views

How to get exit code of a parallel process launched by xargs? [migrated]

I'd made a script for launching parallel rsync process: ...
10
votes
1answer
86 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
47 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
54 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 ...
8
votes
0answers
46 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
45 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
124 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
2answers
111 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 ...
6
votes
1answer
68 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 ...
5
votes
2answers
221 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: ...
13
votes
1answer
114 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
1answer
163 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 ...
1
vote
1answer
71 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
42 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
99 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 ...
8
votes
2answers
125 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. EDIT Newer version with error logging and ...
6
votes
1answer
122 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 ...
16
votes
4answers
752 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 ...
7
votes
2answers
114 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
2answers
94 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 ...
2
votes
1answer
81 views
0
votes
2answers
62 views

Optimize this path location script?

Example Script is located in /home/insp/public_html/deploy/ I want to return the /home/insp/ section ...
-2
votes
1answer
41 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: ...
4
votes
4answers
57 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
145 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* ...
2
votes
1answer
157 views

Bash script to set up an ad hoc wireless network

This script creates an adhoc network using hostapd. I have tested it and seems to work reliably. I am new to linux networking and not sure if this is a recommended way to create an adhoc network this ...
2
votes
1answer
249 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 on their extensions and are moved ...
3
votes
2answers
120 views

Simple linux char driver, am I following recommended and modern idioms?

Since the resources I found to learn are generally out of date, I'm having to read a lot of documentation, which makes the learning process somewhat haphazard. The module makes a simple character ...
4
votes
1answer
183 views

Is this CPUID parser ideal for any usage?

NOTE: I'm not perfectly sure of some of the parsed data, so any corrections are more than welcome. Parser (cpuid.c): ...
3
votes
1answer
292 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 ...
6
votes
3answers
308 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): ...
6
votes
1answer
137 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 ...
2
votes
0answers
89 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 ...
2
votes
1answer
46 views

Input Columns with Awk

I wrote a small script to manipulate fields of a file based on the input of a user. Is there something I could've done better, or perhaps a better refactor? I do know however that I need a way to ...
2
votes
2answers
124 views

Error handling, general architecture and commenting style review

I'm writing a C++ wrapper library for sockets which will hopefully be cross-platform. It's basically two headers: mizaru.hpp, which contains the wrapper classes ...
4
votes
3answers
255 views

Is my overall Python script design the right way to go?

So I'm relatively new to programming in general, and I've finally strapped in and started learning Python. This is my first significant project using it and I'm trying to build good habits with layout ...
2
votes
2answers
298 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 ...
1
vote
3answers
78 views

How to improve the computation speed of my shell script/program?

I have written a shell script to process my huge data files (each one having around 7,000,000 lines ~ a weeks data in a single file). Below is the sample of my data file (i.e., input file) structure: ...
5
votes
2answers
323 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 ...
1
vote
1answer
673 views

Functionality to read large files (> 3 GB) in chunks

Here is a function I wrote that can read chunks of large files (> 3 GB). It's designed to be used contentiously so that one can use it in a while loop until it returns EOF. It's an early prototype ...
2
votes
2answers
510 views

Python class to abstract the iptables Linux firewall

I've written the following Python class that fetches iptables rules using basic string processing in Linux. Am I doing this in the correct manner? I've tested the code and it's running fine. I'm ...
3
votes
1answer
177 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 ...
3
votes
1answer
269 views

How to replace duplicate files with hard links using python?

I'm a photographer and doing many backups. Over the years I found myself with a lot of hard drives. Now I bought a NAS and copied all my pictures on one 3TB raid 1 using rsync. According to my script ...
2
votes
0answers
100 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 ...
2
votes
3answers
151 views

What can I improve in my coding style?

I wrote an example program about UNIX semaphores, where a process and its child lock/unlock the same semaphore. I would appreciate your feedback about what I could improve in my C style. Generally I ...
3
votes
1answer
229 views

Simple IPSec/tunnel setup script

I've developed a script to set up an encrypted tunnel between two Linux hosts, using iproute2, ssh and ...
2
votes
1answer
76 views

Bash script to manage multiple Java Development Kits installations

I'm writing a bash script to manage multiple JDKs, the script is very simple, you have to choose a directory when you store all the jdk's, and the script maintain ...
10
votes
2answers
180 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 ...
2
votes
2answers
403 views

Bash script that can uncompress: tar, gzip, rar

This code generally works exactly as it is supposed to. I'm learning bash I'm looking for some constructive help that could help me improve my work. ...