Linux is a free (libre), open source, Unix-like operating system.

learn more… | top users | synonyms

2
votes
0answers
12 views

File shredder in x86 NASM Assembly

This is a file shredder utility that runs on Linux. It writes random bytes over the file contents, repeating this 48 times and calling sys_fsync after each pass to ...
5
votes
1answer
25 views

Program to print all evironment variables

I'm learning x86 assembly on Linux and this is the first program I wrote, so I'm looking for all kinds of ways to improve it. ...
0
votes
0answers
22 views

Check the battery's charge level and emit an alert on low/high value

The following script check constantly the battery's charge level of the user's laptop via the acpi command. When such level reach a low/high value, the script will ...
4
votes
1answer
43 views

Brightness Web Server

This is the first real program I've written in Go so have at it! I wrote it because I use a tiling window manager that doesn't have any brightness control functionality (at least not that I know of). ...
4
votes
1answer
35 views

Raspberry Pi headless server using bash and USB automounting

Revised from: Bash scripts and udev rules to handle USB auto mounting / unmounting Tested: Uses USB insert/remove to control a headless Raspberry Pi 3 with Raspian Jessie Lite Changes: Implement ...
2
votes
1answer
46 views

Bash scripts and udev rules to handle USB auto mounting / unmounting

Very new to Raspberry Pi and bash, but working on a headless server that will run a streaming app from USB audio card. The plan is to take a USB card with settings file, and when inserted, the usb ...
5
votes
3answers
538 views

Snake game in C for Linux console

Please help me improve this code. Move snake using : a w s d. (My compiler doesn't support initialization of index variables inside loops, so please ignore this part) ...
8
votes
1answer
90 views

Baby-sitting bash script using DVD drive

This is the script I wrote to make an automated POC baby-sitter in 5 lines. I first found this on a GIF or meme site and thought of making a POC script that does the same. ...
8
votes
2answers
85 views

Thread to send heartbeat UDP packets

This C code will run on an embedded machine with a Linux OS. It should create data packets (ASCII) to repeatedly be sent to a UDP server. Just to give an overview about what functions should do: <...
5
votes
2answers
82 views

Thread synchronization with mutex

This program prints odd numbers by thread1 and even numbers by thread2 sequentially. Can this code be optimized or made more ...
1
vote
1answer
42 views
5
votes
1answer
42 views

Bash script for xrandr modification

Simply, I call the script (brightness.sh) and pass a three character value as an argument. I've got commands to strip individual numbers for math processes, and then the final commands to apply the ...
3
votes
1answer
57 views

Template for PHP service (/etc/init.d) script

I wanted a template for a service script that is versatile and easily configurable. Along with producing similar outputs to the SSH and Samba daemons, I request the code to be as clean, simple and ...
4
votes
1answer
36 views

Simple shell script to backup to Amazon over iSCSI

The script works but I know that it can be improved. Please note that my scripting skills are very basic :) (as it can be seen in my Frankenstein script – I took bits and pieces of the code from ...
4
votes
1answer
55 views

Bash script to determine a distro, update, upgrade and install the apps I use

This is my first bash script. I am trying to learn scripting and needed an idea. This is the first idea I came up with. When I used to distro hop I had to reinstall everything. This helped me out once ...
4
votes
1answer
60 views

Watch log dir for new file, automatically tail to slack

We have a process that outputs to log files in the format /var/log/xxx/YYYY_MM_DD.log - the file name is chosen programmatically and is not rotated using logrotate ...
0
votes
0answers
51 views

Resolving the path to a Bash script

I wrote a function to resolve the full path to the current Bash script, and I'm wondering if it's SOLID: ...
-1
votes
1answer
67 views

Measuring execution time of a simple operation

The purpose of the following code is to measure the execution time of a simple operation (1+1) and of a call to a function who does nothing (foo). The code ...
5
votes
1answer
44 views

Bash script to open or close gnome-terminal with a single keybinding

I wanted to bind a single hot key to open and close gnome-terminal in a way similar to terminal emulators such as tilda or guake. I use Ubuntu, and have configured this script to be executed when I ...
3
votes
2answers
50 views

Nagios plugin webdav check 2

Original post: nagios plugin webdav check According to the good advice I have received I've made some modifications to the code: ...
3
votes
2answers
77 views

nagios plugin webdav check

I have written a small plugin for nagios to check a WebDAV server. It is supposed to connect using a username and password and upload & delete a test file This is my code: ...
2
votes
2answers
57 views

Linux C Port Knock Implementation

Compile with: gcc -std=gnu11 -o "portknock" "portknock.c" -lpcap I did this as a learning experience, and it actually ended up being something useful. I made a ...
5
votes
0answers
147 views

Automated owncloud installation script

Here is a shell script which installs and configure owncloud on a Debian server. It also installs apache2 and MySQL as dependencies and fail2ban with a specific rule for owncloud. Apache2 is also ...
4
votes
1answer
151 views

Parsing a string to extract values

I am writing some C# that will be running on Linux and will extract values from a kernel generated system file that represents readings from a sensor. The file contains two lines of text, and I have ...
3
votes
2answers
92 views

Basic shell implementation

Here is a small project to implement a basic shell. It is a personal ongoing project to keep system call usage fresh. It currently does background processes and some basic signal handling. I am ...
5
votes
2answers
268 views

Cleanup and server restart script

I have written a simple script for managing our Tomcat and Apache instances for deployment. What this script basically does is, when called, it copies the ROOT.war ...
3
votes
2answers
71 views

Dockerfile to install Apache

I'm getting started with Docker, and I've set up a very simple image built from a Dockerfile. It's based FROM the ubuntu image, ...
5
votes
1answer
83 views

Constructing a simple shell from scratch

I'm actually doing my whole shell in C from scratch from a Linux computer. The thing is that I think we all do our best from creating the simplest things that can be explained easily. And I'm not sure ...
5
votes
1answer
49 views

Function to get specified key from /proc/cpuinfo

On Linux, the file /proc/cpuinfo returns a set of key-value pairs, where the key and value are separated by a colon and each pair has its own line. It's a bit more ...
1
vote
1answer
40 views

Sh script to reduce version number in opkg status file

I have written a script to reduce/lower the version number stored in opkg status file using small shell script, This will enable us to force the opkg to install same version of a Debian package again. ...
6
votes
1answer
62 views

Subset of UNIX standard tar implementation

I recently implemented a subset of the ustar archiving utility as my first year programming one project. I would like to get it reviewed and if anyone has anything to point out. dir.c ...
6
votes
2answers
48 views

Implementation of the ls command with several options - follow-up 2

I've made more improvements from previous iterations and my own, including: Added the -n flag (print owner and group IDs instead of names) Eliminated some ...
6
votes
2answers
51 views

An installer for shell scripts, written in pure sh

I wrote a tiny shell script that basically installs a script into your system by copying it to someplace like /usr/local/bin, chmodding it, and adding it to your ...
11
votes
2answers
81 views

Implementation of the ls command with several options - follow-up

I've made vast improvements to my previous ls implementation, including: Added new flags: -g (omit owner listing) ...
3
votes
1answer
63 views

Async safe threadpool

I'm trying the write a threadpool that can safely be added inside a signal handler or in code forked by multithreaded code. Are there any corner cases that would cause this code to fail? What could be ...
9
votes
1answer
58 views

Automating a WordPress install

I do not have a whole lot to do over winter break, so I wrote this little script to automate a Wordpress install (currently can only install once instance) on a fresh Debian server (tested, working ...
6
votes
1answer
122 views

Notification script | from RSS to Email | Bash

This is a script that must send an email at each new article published on a specific website. Any suggestions or improvements to do? ...
15
votes
3answers
248 views

Implementation of the ls command with several options

As part of a past assignment, I've expanded on this implementation of ls to have more options available, including non-standard ones. It currently supports these (...
7
votes
5answers
981 views

XOR encryption program in C

I've written a program that encrypts files (or stdin) with a user-specified key from 1 to 255. This "encryption" is very insecure, but still a bit better than ROT13 ...
1
vote
1answer
53 views

Format conversion of localized file | xliff to csv

I need a revision for this code... it's a working code, but i'm pretty sure that can be simplified or even improved. This is for converting a normal xliff file (localization file) into a csv, having ...
5
votes
1answer
51 views

Format conversion of localization files | 3txt to xliff

I'm trying to build an xliff for localization from 3 specific files: one contains a list of IDs, the other a list of source strings and the last, a list of translated strings. Basically, each file ...
3
votes
1answer
92 views

ARP implementation

I am a beginner in C and wrote this code to implement ARP. 3 threads are present - one to respond/receive any ARP packet targeted to me, one to refresh the ARP table on a periodic basis, and one to ...
3
votes
1answer
71 views

Package management system

A short time ago, I discovered the LinuxFromScratch project. After getting a system up and working (after much struggling), I realized that if I wanted to continue using LFS, some sort of package ...
4
votes
2answers
151 views

pthread_cond_wait() based multithreaded Linux daemon skeleton

I'm trying to design a multithreaded daemon for an industrial automation related project. The daemon will be using a number of 3rd party libs like MQTT, mysql, etc.. My idea is to have worker threads ...
-1
votes
1answer
89 views

Server listening for program sockets

Essentially I have a server that will be listening for sockets in other programs seeking a connection: ...
3
votes
2answers
2k views

Complete async OpenSSL example

I am trying to create a fully async example of a client and server using SSL. I think these are the required assumptions: Connecting may require socket readability and writeability notifications. ...
4
votes
2answers
195 views

Reverse all lines in a file

The script below should open a file, read and reverse every line, then overwrite the source file. ...
3
votes
2answers
64 views

System backup on Linux - follow up

This is a follow-up to System backup on Linux. I've done a lot to my script since I asked my first question and I think I could improve a lot while doing this. The script still does the same, only a ...
6
votes
1answer
169 views

System backup on Linux

I've written this Python script to make regular backups of a Linux server. It works pretty well except that the script sometimes backups files more than one time, which is pretty strange and I don't ...
2
votes
2answers
38 views

Split redirecting to multiple files in bash

A function mycommand which runs command and: Gives me three log-files which are: *.stdout.log: everything from ...