Import new functions from file in C at runtime

Is there any way to import a file of functions at runtime in C? Meaning that from user input (or maybe as compiled programs are added to a directory), the main function could call functions in these using trampolines? For example, a directory would ...
more »

2017-03-19 08:03 (0) Answers

On Linux, how to draw a text to a bitmap?

Suppose I have allocated a 2-D array int bitmap[WIDTH][HEIGHT]. I wish to let the Linux system draw a line of text, say "Hello World.", to this bitmap buffer as if Linux is printing a normal text on screen, so that I can extract the bitmap pattern of...
more »

2017-03-19 04:03 (2) Answers

How to make text after "read -p" bold?

I want to echo a text before the read with read -p. How can I make the text inside of the read -p bold? I don't want the user input to be bold. I just want the "content" part bold. Example: read -p "content:". content: should be bold. I tried tput...
more »

2017-03-18 19:03 (1) Answers

Checking sudo in Bash (script with if statements)

I've been working with bash for not more than 6 hours, and now I'm trying to create a menu that allows you to do some "fun" stuff :D. My problem is with the if statement that check if you're in sudo mode. I want to have 3 conditions: If I execute ...
more »

2017-03-18 15:03 (1) Answers

compare time in bash script with ± x min

I'm newbie in bash and need some advice. I have a .txt file with a time stamp inside that is reloaded every x time, and each time stamps the current date and time. "20221218-0841" Now i have build a bash script to check the content and give me an...
more »

2017-03-18 09:03 (2) Answers

my little asm program has a segment fault

I am a newbie to assembly language, and here is my little program. section .data section .text global _start _start: nop ; make gdb happy ; put your experiments here mov eax,4 ; put your expeirments here nop ; make gdb happy se...
more »

2017-03-17 12:03 (1) Answers

Cannot change default action for SIGINT

In C, I want to catch the SIGINT signal and print out a message like "SIGINT received" by using sigaction and passing a new handler to it via sa.sa_sigaction = handler; I don't want to terminate the program. If I run my program through the shell ...
more »

2017-03-17 09:03 (1) Answers

Distribute C++ binaries across linux

I would like to distribute C++ binary that is created by using Eclipse ++ IDE, with the following settings: Cross GCC Compiler: gcc -std=c++17 Cross G++ Compiler: g++ -std=c++17 Tool Chain settings: Cross GCC Compiler Cross G++ Compiler Cross GCC L...
more »

2017-03-17 07:03 (1) Answers

Make my module a command

I'm pretty sure I read it somewhere but I can't find any doc about it anymore. I did a python (3) module, let say I called it addition. I have my sources, my tests, my setup.py is OK. I can import & use it from anywhere in my system. It's OK. W...
more »

2017-03-16 16:03 (1) Answers

Linux Script Command With PS1 Change

Saw one post here: Change PS1 after running the 'script' command but it didn't seem to answer the question. I am trying to have a script run the "script" command and also change the prompt (PS1) to indicate that the shell is now scripted. B...
more »

2017-03-16 15:03 (3) Answers

Removing files with rm using find and xargs

When I do rm file.txt or rm *.txt I'm prompted for each file, since I didn't specify the -f option to rm. But when I do this: find . -type f -name '*.txt' | xargs rm the files are removed without the confirmation. What is the logics behind...
more »

2017-03-16 08:03 (1) Answers

Find the longest file name in Linux

I am searching for the longest filename from my root directory to the very bottom. I have coded a C program that will calculate the longest file name's length and its name. However, I cannot get the shell to redirect the long list of file names t...
more »

2017-03-15 13:03 (3) Answers

PHP program create installable package

I have the following PHP script, and I'd like to create a package that people can install easy, something similar to this: sudo dpkg -i packagename.deb Any ideas on how can I do this? /home/script.sh #!/bin/bash echo "Starting NAME service" sud...
more »

2017-03-15 09:03 (1) Answers

-bash: !/usr/bin/env: event not found

I got this strange error message trying to write shebang to a python script: $ echo "#!/usr/bin/env python" > scripts/sandbox.py -bash: !/usr/bin/env: event not found $ echo "say what?" > scripts/sandbox.py Immediately, doing the same thin...
more »

2017-03-15 00:03 (1) Answers

Why is os.walk() not defining dirs or files?

I have this code in Python 2.7: # !/usr/bin/python import os root=os.path.normpath('/home/andreas/Desktop/') print root for root, dirs,files in os.walk(root, topdown=True): break print(files) Which works. It returns a list with the filena...
more »

2017-03-14 21:03 (1) Answers

Record a html5 page as a video

My goal is to have a Ubuntu (Desktop) server that "simply" converts html5 webpages into videos. I want to capture the smooth css and js-animations. So far I've tried this: (phantomjs) https://gist.github.com/phanan/e03f75082e6eb114a35c The timing a...
more »

2017-03-14 20:03 (0) Answers