linux

Is there assembler REPL under linux?

Recently I've started plaing with assembler under linux, there's good debuger, but comming from Ruby I'm missing simple REPL that would let me enter a line of assembler code and see the result on registers flags and stack. Can anyone point me in good direction? ...

Unzip a bunch of zips into their own directories

I have a bunch of zip files I want to unzip in Linux into their own directory. For example: a1.zip a2.zip b1.zip b2.zip would be unzipped into: a1 a2 b1 b2 respectively. Is there any easy way to do this? ...

Executing external commands

I am attempting to make a program in C which presents a GUI and allows the user to select from a list of applications, which to install on the computer. I can manage the gui, but I've never been taught how to actually issue command line commands. I know with bash its just apt-get install firefox for example, but how do I do such a thing ...

filter log file by defining regexes

I have some HUGE log files (50Mb; ~500K lines) I need to start filtering some of the crap out of. The log files are being produced using log4j and have the basic pattern of: [log-level] date-time class etc, etc log-message I'm looking for a way that I can identify a regex start and regex end (or something similar) that will filte...

How to rate-limit a pipe under linux ?

Is there a filter which I could use to rate-limit a pipe on linux? If this exists, let call it rate-limit, I want to be able to type in a terminal something like cat /dev/urandom | rate-limit 3 -k | foo in order to send a a stream of random bytes to foo's standard input at a rate (lower than) 3 kbytes/s. ...

Implementing an experimental TCP stack on Linux

I have a requirement to implement an experimental TCP stack on Linux. In essence, I need to override any flow control, congestion control, window size adjustments, etc. I have a layer that sits on top of TCP that adds data to the SYN, SYN|ACK, ACK packets in the handshake. I also need to provide my own packet scheduling for transmissi...

Etiquette for adding repository during rpm/deb install

We're distributing a commercial application for Linux and we currently make it available for download as a .tar.gz, a .rpm, and a .deb. We're setting up both RPM and DEB repositories to make upgrading easier. Is it appropriate to add our repository to /etc/apt/sources.list or /etc/yum.repos.d automatically as part of the initial instal...

Windows to Linux utf-8 file

I have a file UTF-8 encoding in windows, and when i use it under windows it shows everithing right, but when i copy the file in Linux, the Unicode characters are giberish. The file is plain textfile. How can i get this file to be readable in linux, or how can i copy it properly?? thanks in advance ...

How to deal with symbolic links when going between Linux and Windows?

I have a django project that runs on a Linux server, and I've been working on it both on Linux and OS X. I've noticed that some of the pages are a bit off, to put it politely, in Internet Explorer, and so I checked out the subversion repository on Windows and tried to run a local server. My media directory has symbolic links to all of t...

Linux UML - Need gcc on the UML instance. Would like to mount gcc from hostfs

I know how to mount the hostfs directories when needed for my UML Linux instance. I need to get gcc and all it's dependencies from my host Linux instance by mounting the files in my UML instance. I think the paths are not working properly because it comes up with an error about cc1 and execvp when I mount all files and try to run gcc. ...

Using wget via Python

How would I download files (video) with Python using wget and save them locally? There will be a bunch of files, so how do I know that one file is downloaded so as to automatically start downloding another one? Thanks. ...

How to use of animation in Qt for stacked widgets?

i am using stacked widget and i want to have the following effect : when i press a pushbutton , the button should move to the center and gradually fade out at the same time. while the button is fading the next page of the stacked widget should gradually fade in or any kind of animation would do. tried many thing but i got unsatisfactory ...

configure batch to sent minute info instead of entire stdout

Hi all, I am working on a RedHat server along with several other users. We use the batch utility to set a job queue. Some of the programs that I use write stuff to stdout during the run, with info on who much data has been processed to far and estimated time until completion etc. batch -q z at> myScript -i somefile -o someotherfile ...

Script doesn't work when executed with sudo

Linux bash script: function Print() { echo $1 } Print "OK" This script runs successfully, when executed directly, and gives an error running with sudo: alex@alex-linux:~/tmp$ ./sample-script OK alex@alex-linux:~/tmp$ sudo ./sample-script [sudo] password for alex: ./sample-script: 1: Syntax error: "(" unexpected Why? ...

How can I diff two files and report the section the diff occurs in?

I have two text files with several sections in them. Each section has has a header with the section name (grep can extract all the section names without extracting anything else from the file). How can I report the differences between the two files AND report the section that the difference occurs in? I would also need to be able to r...

shadow password

I'm trying to compare shadow password with php cli but not work ! i use this function so i can create password like shadow function shadow ($input){ for ($n = 0; $n < 9; $n++){ $s .= chr(rand(64,126)); } $seed = "$1$".$s."$"; $return = crypt($input,$seed); return $return; } when i replace the result in sha...

Prevent * to be expanded in the bash script

Linux bash script: #!/bin/bash function Print() { echo $1 } var="*" Print $var Execution results: alex@alex-linux:~/tmp$ ./sample-script sample-script "*" is expanded to the list of files, which is actually script itself. How can I prevent this and see actual variable value? In general case, var can be more complicated tha...

Linux network programming. What can I start with?

Hi everyone! I've recently got interested in Linux network programming and read quite a bit (Beej's Guide to Network Programming). But now I'm confused. I would like to write something to have some practice, but I don't know what exactly. Could please recommend me a couple of projects to start with? Thanks. ...

Why is X11 Composite extension incompatible with Stereo visuals?

In the NVIDIA README for the Quadro card X driver, there is this comment: Workstation overlays, stereo visuals, and the unified back buffer (UBB) are incompatible with Composite. These features will be automatically disabled when Composite is detected Is there some fundamental X reason why this is so? Why are quadro cards ...

Serial port determinism

This seems like a simple question, but it is difficult to search for. I need to interface with a device over the serial port. In the event my program (or another) does not finish writing a command to the device, how do I ensure the next run of the program can successfully send a command? Example: The foo program runs and begins writin...