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

learn more… | top users | synonyms

1
vote
1answer
65 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 ...
1
vote
2answers
93 views

Python class to abstract the iptables linux firewall

I've written the below python class that fetches iptables rules using basic string processing in linux. Could you plz go thru it and tell me whether I'm doing this in the correct manner. I've tested ...
3
votes
1answer
50 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 ...
0
votes
0answers
34 views

Directory's disk usage list

For my classes i had to finish this task. Problem 5.5 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
132 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 ...
2
votes
1answer
61 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 setkey. The goal is to allow setting up ad-hoc secure tunnels with minimum of setup and ...
1
vote
1answer
37 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 a symlink to the current jdk'. ...
1
vote
0answers
37 views

x64 assembly clearmem / zeromem

I 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 of this function, whether there any ...
1
vote
2answers
72 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. #!/bin/bash usage() { echo "Program for ...
2
votes
1answer
79 views

lightweight packet sniffer review

This is a simple packet sniffer that turns on LEDs when there's network activity. It works by picking up filters in a configuration file and listen for activity in those filters. When there's a ...
2
votes
0answers
27 views

Accelerate OpenGL 2d on python3

I used OpenGL to draw about 20 circles. Each circle has 2 lines, ~10 segments, and all of them have different colors and lenght. FPS ~=4. How can I do this faster? I am using Python 3 on Ubuntu Sorry ...
-1
votes
1answer
25 views

bash file manipulation [closed]

I have files in a directory named so: 1welcome.avi 2introdution.avi I have a rhcsa.txt file that has what these files should be named as: rhcsa_1_welcome.avi rhcsa_2_introduction.avi both the ...
1
vote
3answers
164 views

Possible improvements for this small C program?

I'm learning C and today I wrote a program that displays info about my hardware on ubuntu. #include <stdio.h> #include <stdlib.h> int main() { char ch, file_name[25] = ...
1
vote
2answers
100 views

First Database Schema - How did I do?

I would really like some advice from any DB gurus who have a few minutes free. After doing some reading and playing with sqlfiddle over the weekend I have constructed this postgresql schema and it is ...
2
votes
2answers
96 views

Need some advice and feedback on my C code calling Bash functions

My intent is to use Bash functions defined in functions.sh in a C program. I am doing this so that I don't have to rewrite the Bash functionality again in C. I want to use one common library for ...
17
votes
5answers
1k views

Naive C++ Matrix Multiplication 100 times slower than BLAS?

I am taking a look at large matrix multiplication and ran the following experiment to form a baseline test: Randomly generate two 4096x4096 matrixes X, Y from std normal (0 mean, 1 stddev). Z = X*Y ...
1
vote
1answer
46 views

Are these set-uid scripts/binaries secure?

I have a system that needs to be able to reboot a different piece of hardware partway through a script that programs it. It used to wait for me to come and reboot the hardware halfway through, but ...
-1
votes
1answer
106 views

Readers and writers (writers-preference). I'm not sure whether my code is wrong or not [closed]

I've found on the wikipedia pseudo-code, so I've decided to try it. That's the Wiki's code: int readcount, writecount; (initial value = 0) semaphore mutex_1, mutex_2, mutex_3, w, r ; (initial value ...
5
votes
3answers
84 views

Can I speed up this simple versioning/backup script?

I'm writing a simple automatic backup/versioning bash script. It should basically mirror a directory structure somewhere, and then copy files over there when they've been altered. The ghost files ...
2
votes
0answers
183 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 ...
1
vote
0answers
471 views

C++ TCP Socket Server for Unix

I'm very new to C++, (7 days ago I wrote "Hello World") 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 ...
1
vote
1answer
2k views

Producer-consumer in C using pthread_barrier

We're preparing for an exam at the moment, and our lecturer has given us a sample problem to work on. I have it completed, but would like to know a) If it is actually doing what it's supposed to, and ...
2
votes
1answer
108 views

Ls improved, constructive criticism

I have written a script that improves the Linux terminal experience. This script is introduced here: http://hermannn.com/programs/aa/. It basically displays the content of the terminals current ...
1
vote
1answer
354 views

Python pyinotify script to run in the background Linux

I want to be able to run this script in the background on a linux machine. Not really doing a program.py & but if you notice to kill the notify process I have a try & except statement that ...
3
votes
4answers
143 views

Improving file reading

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 ...
1
vote
1answer
71 views

Trimming whitespace from the beginning and ending of a file

In the code below, I want to remove the "white space character" from 2 places only, from the end of 1st line and from the end of last line. How can I optimize it ? Platform : Linux , gcc compiler ...
2
votes
0answers
136 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 ...
1
vote
3answers
924 views

Bash script to swap out, edit host files

So this is my first useful bash script. It's meant to make it easy to switch between a "work" hosts file (that blocks sites like reddit.com, youtube.com, etc.) and my normal hosts file, and also to ...
2
votes
2answers
83 views

How to improve the way I handle greping in this script

What my script does is: Append data to a file on a continuous basis. If an error pattern is observed, then do something. I need feedback on the way I am grepping for patterns in the continuously ...
4
votes
2answers
209 views

Suggestions needed to improve my code ( bash script)

I wrote a bash script to print contents of files in a given directory in a loop. I kindly need suggestions mainly on the following aspect: How can I improve command line parameters handling to the ...
3
votes
2answers
2k 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 ...
1
vote
2answers
340 views

Correct User Input - x86 Linux Assembly [closed]

So I am working on an x86 Assembly program for Linux using NASM. This program basically asks the user for their name and their favorite color. After doing this and storing the two strings in variables ...
2
votes
0answers
537 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 ...