Skip to main content

Questions tagged [linux]

Use this tag for code that specifically targets the Linux operating system (consider [unix] for more portable code that should run on other Unix-like systems).

33 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
191 views

Single-threaded coroutine in C (Linux x86-64)

Background Story I crafted a simple single-threaded coroutine in C, running on Linux x86-64. Short Technical Explanation 1) Task There are two types of tasks in this implementation. Main task. This ...
Ammar Faizi's user avatar
5 votes
0 answers
257 views

Google Drive migration Python script

I am looking to see if someone is willing to take the challenge in optimizing this noob python script. The purpose of the script is to: Check if Google Drive File Stream is installed Check if Google ...
AbsterT's user avatar
  • 161
5 votes
0 answers
1k views

Start a sub-process (with sudo) as head of new process group, kill it after timeout, get the output

This is a bit of a tricky one ... I am writing a test suite for a Python project - running on Linux. As part of the tests, I have to fire up various commands (shell commands, small CLI tools, Perl ...
s-m-e's user avatar
  • 273
4 votes
0 answers
131 views

Processing large blocklists with GNU Parallel

This is an ongoing project that has undergone a major update to speed up list processing. Here is the homepage for anyone interested! It processes lists defined in ...
T145's user avatar
  • 3,099
4 votes
0 answers
505 views

tar-backup V1.01 - backup script for Linux (full and differential backups)

The backup script itself. Make it executable and place it somewhere in your path: ...
xxxLCxxx's user avatar
4 votes
0 answers
266 views

WSL LAMP stack script

The following code is aimed to establish a WSL based LAMP environment. This is instead XAMPP or WAMPP based LAMP environment which doesn't allow Bash. The script includes a cat heredocument called "...
Arcticooling's user avatar
4 votes
0 answers
394 views

Linux performance using multi-threads (vs one thread) and ssh message

My server receives requests in one thread and responds in another. I am using thread pools of pthread-s for both receiving and sending. The performance is not that bad, however... When I am doing the ...
Eliad Cohen's user avatar
3 votes
0 answers
78 views

The Blacklist v2

This script gathers domains listed from sources in this JSON file and compiles them into one text file. Text files that have a similar key under the whitelists ...
T145's user avatar
  • 3,099
3 votes
0 answers
105 views

Bash script to mirror XWindow to remote SSH host

The source code within this question aims to provide a short-cut for mirroring a local XWindow (or session) to a remote host via SSH port forwarding, such as: ...
S0AndS0's user avatar
  • 976
3 votes
0 answers
660 views

Linux System Monitor

I made a system monitor on Linux which gives you all this information: The full project can be found in my repo: https://github.com/sandro4912/System-Monitor In short it works as following: I read ...
Sandro4912's user avatar
  • 3,074
3 votes
0 answers
40 views

Merging multiple awk commands while retaining functionality

Turned in a project a few days ago, and I needed a way to filter and format values off a file. I decided to go for a bash script since it seemed like a good option, and I came up with the following: <...
rubbun's user avatar
  • 31
3 votes
0 answers
41 views

NRPE script for monitoring filesystems usage

Next script returns NRPE friendly output. It checks percentage usage of all local filesystems. Desired output if everything is ok: OK | /=56;;;; /boot=20;;;; /opt=40;;;; /var=60;;;; (and ...
David Mosler's user avatar
3 votes
0 answers
74 views

Cache line versus struct size testing

There's a mission-critical ring buffer in production on which I'm curious to test some optimizations. Specifically, I'm wondering how much of a performance difference struct size will make on issues ...
pdm's user avatar
  • 307
3 votes
0 answers
870 views

Implementing binary-heap in x86-64 assembly

I'm trying to implement some of the simplest classical data-structures in x86-64 assembly on linux. PRIMARY GOAL: Reduce memory consumption and increase performance (maybe using x86-64 architecture ...
St.Antario's user avatar
3 votes
0 answers
109 views

shared_mutex prototype implementation

Anyone feels to review a prototype C++11 shared_mutex implementation? Not recursive, not protected and potentially dangerous if used incorrectly, but allegedly fast in case of many R/O less R/W ...
Emanuele's user avatar
  • 240
3 votes
0 answers
84 views

TTY Menu With For X-less Linux

I am working on a vanilla Python menu system for the Linux console. The idea is to provide as much of the same functionality that a traditional DE provides - basic menus for accomplishing common tasks....
matthew ruane's user avatar
3 votes
0 answers
598 views

Touchscreen Right Click

I have built a small script that provides touch screen right click context menu with long touch press in my ELAN touchscreen. There is no need to remove your finger in order context menu to pop up. ...
George Vasiliou's user avatar
3 votes
0 answers
136 views

msysGit to Unix sockets

I wrote this small script to help porting msysGit sockets to WSL ("Bash for Windows"). I'm not a big Python programmer so any feedback would be well appreciated. By the way, I made it a public Gist ...
Florin Asăvoaie's user avatar
2 votes
0 answers
61 views

a C/Python X server interface extension package

The project is named winlin; it's a portmanteau of the words window and Linux. I'm working on a CPython extension to interact with the X server and manipulate windows. I don't have a ton of ...
gnarlyninja's user avatar
2 votes
0 answers
338 views

Ansible to automate dev environment setup

This is a follow-up to Bash script to automate dev environment setup. In that question I'd thrown together a (sloppy) shell script to automatically setup my development environment. One of the answers ...
Coupcoup's user avatar
  • 1,064
2 votes
0 answers
84 views

Ruby script for automating software install on a brand new Linux OS

I have some scripts to automate software install, apply some configurations and so on after installing a new system. I used to have them as bash scripts but it was generally a poor idea. I have ...
reducing activity's user avatar
2 votes
0 answers
73 views

Apache reverse proxy security configuration

Could someone share some light and check if this is okay for apache httpd security/good standards? I'm using apache httpd to call my Node.js app that is running with Express and also configuring SSL. ...
xDG's user avatar
  • 121
2 votes
0 answers
194 views

Blocking serial port C library

I am planning to write a reasonably feature rich serial library but wanted to cut my teeth on something fairly basic. This serial library is fairly simple. It is a thin wrapper on the UNIX open, ...
arcomber's user avatar
  • 2,449
2 votes
0 answers
71 views

Code to backup the history file in Linux

How is the logic, efficiency and can it be improved? This is a snippet from my .bashrc file; I just wrote it and I've tested it and it almost works. This was the ...
somethingSomething's user avatar
2 votes
0 answers
344 views

Simple Go Linux daemon to send/receive gob-encoded data on a socket

I'm currently working on a linux daemon and would like some feedback. The program is a simple unix socket server that sends around gob encoded messages. I'm still getting the hang of concurrency in go ...
Walt Byers's user avatar
2 votes
0 answers
485 views

Flask app to administrate network interfaces

I made a Flask app that consists of 3 pages. Index: Indexes to the 2 pages SubnetOverview: SSH's into the server and executes ifconfig, then returns the output to ...
Woask's user avatar
  • 125
2 votes
0 answers
37 views

Script to report disk usage

I am trying to see how I can speed up the below script that reports disk usage. The timed find command towards the end is the problematic line that I am trying to ...
user186743's user avatar
2 votes
0 answers
39 views

Shutdown or reboot system from LAN

I've written a simple web service which allows a user to shutdown or reboot a system from the LAN. Although written to be used on an RPI which lacks a power or reset button, it can be used on any ...
user3628960's user avatar
2 votes
0 answers
127 views

Read file real time with while loop and trigger action on change

I want to read a file real time with a while loop that is being fed by the stdout of a process (inotifywait). The output could ...
axm__'s user avatar
  • 121
2 votes
0 answers
1k views

Optimize platform independent GetTickCount()

I used this method as a platform independent tick counter. Unfortunately, it consumes ~10 % cpu time in one of my methods. Is there a faster way to solve the issue? ...
dgrat's user avatar
  • 491
2 votes
0 answers
96 views

Python script to take a break

The idea may sound stupid, but this is what I got to know that you should take a break at regular intervals to not to strain your eyes. So the idea is to take break of 2 minutes for every 20 minutes ...
Here_2_learn's user avatar
2 votes
0 answers
3k views

Ansible shell command status check

I have a task which checks the status of a process running on a Linux server using a shell. The task should report as failed when the status is NOT RUNNING. The following works but is there a better ...
clicks010's user avatar
0 votes
0 answers
279 views

Simple header-only thread and mutex for both windows and linux in C

I wanted to get some thread support on windows with very simple headers for a library that I'm working on but it had to work on both Windows and Linux. Since C11 threads are not widely supported, this ...
LeoVen's user avatar
  • 335