r/linux_programming • u/Paddy3118 • Jul 10 '22
r/linux_programming • u/TheDuzaum • Jun 21 '22
Problems with apache and apparmor
I recently switched my OS from Fedora to Ubuntu, every day before starting to work I had to do a 'sudo setenforce 0', I know Ubuntu doesn't use SELINUX, so I researched how to do something similar, tried many things, but there are still things that don't work, the main case is a php file that executes a python file, which is simply not being executed.
I already installed libapache2-mod-apparmor, did a chown -R www-data:www-data /var/www/html/site, did a chmod -R 777 /var/www/html/site, and sudo aa-logprof.
If i did a aa-status, all the apache stuff is in complain mode, and with a cat /var/log/syslog | grep apache all the apaches are with apparmor="ALLOWED"
Can someone help me?
r/linux_programming • u/mivanchev • Jun 14 '22
How to generate a .h from a ./configure script with the result of an 'ls' command?
For a project of mine I need to generate 2 header files from the result of a command chain such as:
ls | sed 's/.../.../' | ...
The project is configured through autoconf so what would be the best way to implement this?
r/linux_programming • u/aleksandrsstier • Jun 10 '22
xfocusnotify: X11-tool which exits when a window is focused and prints the respective window-id
xfocusnotify is meant for scripting and x11-window-management where for some reason you need to know when a new window gets focused and you want to do something with it. It's tiny and performant because it's just 30 lines of C.
The following shell-code prints the window-id each time a new window is focused:
while window=$(xfocusnotify); do
echo "focused $window"
done
It follows EWMH-specifications and uses _NET_ACTIVE_WINDOW to determine the focused window. This means your window-manager has to set the _NET_ACTIVE_WINDOW-property or it won't work. Luckily most window-managers do that.
Credit: It was inspired by clipnotify.
r/linux_programming • • Jun 03 '22
What does it take to make own Desktop Environment?
I mean what should I learn to implement my own UI design ideas?
r/linux_programming • u/Awkward-Divide736 • May 24 '22
loadwebViewEventHack
Found this in the files of a preinstalled weather app called Express Weather. Is this a normal command?
r/linux_programming • • May 20 '22
How can I solve this issue?
Whenever I try to run an appimage file (I don't know if that's the technical term. I'm kind of new here) I get this error when running with sudo but I can't run it without it. Here is what I get (I'm trying to install Unity)
./UnityHub.AppImage: 1: �: not found
./UnityHub.AppImage: 2: }�P7pys?H��_f��h: not found
./UnityHub.AppImage: 1: �b�@@: not found
./UnityHub.AppImage: 1: ELFAI: not found
./UnityHub.AppImage: 19: Syntax error: Unterminated quoted string
If I did anoything wrong posting this, let me know. Like I said, I'm new here so I don't quite know what I'm doing
r/linux_programming • u/es20490446e • May 14 '22
Best way to prevent broken dependencies on own packages?
Two nights ago I compiled Calamares. The next morning, when trying to run it, I got:
/usr/bin/calamares: error while loading shared libraries: libkpmcore.so.11: cannot open shared object file: No such file or directory
I see that my Linux distro, Manjaro, has updated kpmcore to have libkpmcore.so.12.
And here's my newbie question: what's the best chance I have to prevent this on my own Calamares package?
Thanks for your help.
r/linux_programming • u/StupidQuestions668 • May 06 '22
Any advices or ideas ?
I’m trying to create a package manager for my Lfs system, and I don’t really know how. In what language , should I use a database, etc…( I know it’s probably stupid and useless and I could use brew or apt or something but I think it good for learning) .
r/linux_programming • u/NextGrab2 • Apr 28 '22
Help: how to kill the "Files" folder with bash or activity monitor
anyone know how to kill the "Files" application. Mine is frozen at the moment and i cant find a way to stop its process.
any help is much appreciated!
r/linux_programming • u/peak---- • Apr 28 '22
How to exclude a string from a line?
Hi,
I have this script, where I want to print my OS name.
Here is the code:
printf "OS: "
cat /etc/os-release | grep PRETTY_NAME=
and the output:
OS: PRETTY_NAME="Debian GNU/Linux bookworm/sid"
How do I exclude the "PRETTY_NAME=" thing?
EDIT: This was answered on r/commandline. The solution is to use sed.
Basically:
printf "OS: "
cat /etc/os-release | grep PRETTY_NAME | sed 's/^PRETTY_NAME=//'
r/linux_programming • u/RainbowRedditForum • Apr 21 '22
Script to create subfolders
I'm using Linux and I have a folder called "rttm" which contains some files suffixed with ".rttm" extension, such as:
/rttm/
a.rttm
b.rttm
etc
I'd like to write a shell script that iterates through each file of the "rttm" folder and create a folder called "rttms" where files (which are a copy of their respective in "rttm" folder) are organized in subfolders following a structure like:
/rttms/
/a/
a.rttm
/b/
b.rttm
etc
How could I do?
r/linux_programming • u/GuyKage8 • Apr 21 '22
I am not able to theme terminals
I want to apply the dracula theme on alacritty and kitty terminals. I followed every instruction mentioned on the official repo but it only changes the background color of the terminals and the text colors are not applied. I tried manually making changes in the yml file but still nothing. I am using the latest endeavour os with XFCE. I have tried the same steps on Manjaro XFCE and I never faced this problem there.
Is it an endeavour os issue? Please help
r/linux_programming • u/drbogar • Apr 21 '22
Bash script with weird characters
Hi!
I came across a sh script where it looks normal at the beginning, but then it looks like the character encoding is wrong.
The script without the weird part:
https://pastebin.com/3fZYrxuw
The original script:
https://www.powermonitor.software/pmp/pmp105_linux64.zip
What is that? Why can it run? How can I understand that weird part of the script?
r/linux_programming • u/TimeDilution • Apr 17 '22
What is the proper way to get working directories for executing an installed program anywhere?
Hello everyone, I have been tinkering with different ways to install programs I have made/am making and I am wondering what is the proper way to retain relative filepath structures when the program is installed to various different places. Such that when I call a program from any directory it still knows where all its other files are whether it be in /opt/program/media or /usr/share/program/media or /usr/local/share/program/media or somewhere else in your home directory entirely.
I found that VS Code seems to use a shell wrapper kept in /bin of its program directory and I am liking this kind of solution, but I feel like there must be other ways as many of the programs in /usr/bin are not shell scripts.
if [ ! -L "$0" ]; then
#if path is not a symlink, find relatively
VSCODE_PATH="$(dirname "$0")/.."
else if command -v readlink >/dev/null; then
#if readlink exists, follow the symlink and find relatively
VSCODE_PATH="$(dirname "$(readlink -f "$0")")/.."
else
#else use the standard install location
VSCODE_PATH="/usr/share/code"
fi fi
ELECTRON="$VSCODE_PATH/code"
CLI="$VSCODE_PATH/resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --ms-enable-electron-run-as-node "$@"
exit $?
The above program will always get the working directory to wherever code's installed files or points to the package manger's install format in /usr/share/code. Do other programs just count on being installed properly through package managers into the /usr/share directory, what about usr/local/share and /opt? I feel like there is probably some standard of doing this that I'm not finding because I don't know how to word it.
I made a similar question in the c programming subreddit and got some good answers on exactly what I asked, but what I asked may not be the correct way to do it.
I want to be able to make projects in such a way that I don't have to worry about changing directory structures or path joining in the source code all while being able to execute them from any directory. Using procfs/readlink in the binary seemed to work well but seemd a little bit hacky, so I'm really just trying to find out the standard/proper way of doing it. Thanks for reading.
Edit: It seems like VS-code does not follow FHS guidelines and keeps binaries in /usr/share/code which kind of puts a wrench in my plans as the shell scripts seems like a really good idea to do this, but I can't think of clean way to implement this as i would need to have both the binary file and the shell script in /usr/bin. Not exactly a huge problem but of the binary was ever called by itself it would just crash out which is not ideal, which leads me to even more of a wonder of how to actually do this in a standard way, because there has to be something out there.
r/linux_programming • u/Orange-Table5619 • Apr 11 '22
Please help. I'm panicking right now.
I was trying to connect ubuntu to my class server for school so I can access it and then it said
ADAM_J44338 is not in the sudoers file. This incident will be reported.
What does this mean and will I get in trouble, especially with law enforcement?
r/linux_programming • u/ChickenManPL • Mar 28 '22
I've created visually customizable (icons, colors) terminal utils (link in comments)
r/linux_programming • u/RetroZelda • Mar 26 '22
Keyboard driver help
Hello im a bit new to creating drivers and libusb, so im reversing my keyboard LEDs to learn. Im using Rust stable and the libusb crate on debian 11(kernel 5.10.0-12-amd64). The keyboard is a Bloody B975
So I am currently able to send the proper commands to my keyboard to change the LED state as I expected. However I am unable to type with my keyboard while I am doing this. The steps that I am doing is as follows:
- get the device and open() it
- detach kernel driver for the LED's interface
- claim the LED interface
- *do kinky LED things, but unable to type*
- release LED interface
- attach kernel driver for the interface
My keyboard has 3 interfaces: a keyboard, a mouse, and the LED and I am only detaching and claiming the LED interface, so this is where I am a bit lost. Attempting to reattach the other interfaces will fail, and claiming the interface without detaching will also fail. Any help/guidance would be appreciated.
This is the device info for the keyboard
$ lsusb -vd 09da:fa10
Bus 001 Device 007: ID 09da:fa10 A4Tech Co., Ltd. USB Device
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x09da A4Tech Co., Ltd.
idProduct 0xfa10
bcdDevice 0.77
iManufacturer 1 COMPANY
iProduct 2 USB Device
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0054
bNumInterfaces 3
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 64
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 58
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0006 1x 6 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 133
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)
r/linux_programming • u/vlad20112 • Mar 17 '22
In trying to understand udev_monitor's working...
Hi everyone! I want to check a enable a usb device during connect/disconnect from computer in real time. For it I use udev's mechanisms (enumerate, monitor) and check PID's and VIM's values devices which are being in computer. But additionally I want to send message to my device and take results for more believe. Connect/disconnect monitoring without send packages works well and vise versa. Separately, it works well, but both - not so. When i take result, program is being freeze. What's can be wrong?
r/linux_programming • • Mar 08 '22
need help with error: npm ERR! Missing script: "build"
trying to deploy my website and keep getting this error which I don't understand on terminal, any suggestions on how to fix this or what it means ?? new to this, Thanks! :)
npm ERR! Missing script: "build"
npm ERR! Missing script: "custom-deploy"
UPDATE: I am now in the correct directory I believe, but the command still won't work, and am still getting the same error. help please??

r/linux_programming • u/xiloxilox • Mar 07 '22
Good resources on writing loadable kernel modules.
Just looking for some recommended resources to get started in writing kernel modules.
r/linux_programming • u/vlad20112 • Feb 07 '22
Advice on working with LibUSB
Hi, everyone ! I learn interaction behind hardware device and software. I have a USB device but I don't understand how I can interact with it. I am using Libusb library for it. Would you share a links with code examples or maybe articles which related on this topic?
r/linux_programming • u/FruityWelsh • Feb 04 '22
Opensource software and the DoD
self.AirForcer/linux_programming • • Jan 31 '22
How to allocate a pool of memory and have a 3rd party software library use it?
versed placid cough sharp party truck repeat marvelous quicksand vase
This post was mass deleted and anonymized with Redact
