Linux

How to poll for GPIO interrupts in python?

I need to poll for interrupts on a GPIO pin using python 2.7, and I wonder if there are any native functions or libraries to help me do that? When searching for anything like this I find a lot about Raspberry Pi, but that is not what I need. Is this doable? Source: linux

setuid vs seteuid function

What is the difference between setuid and seteuid function. In man page both of the function have similar description. setuid: DESCRIPTION setuid() sets the effective user ID of the calling process. If the effective UID of the caller is root, the real UID and saved set-user-ID are also set. seteuid: DESCRIPTION seteuid() sets the effective user ID of the calling…
Read more

vsftp: can not delete a directory that upload by an anonymous user

I had setup a vsftp server in SUSE11 and enable anonymous user to upload file and create directory.In addition, i have create a ftpuesr as administrator. The configure of vsftp as follow: anon_upload_enables=YES anon_umask=001 anon_mkdir_write_enables=YES anon_other_write_enables=YES anon_root=/home/ftpuser/admin/ chown_upload=YES chown_username=ftpuser I want use “chown_username=ftpuser” to change the owner of the file and directory that upload by annonymous user, therefor i can…
Read more

ipython: Why "%matplotlib inline" run correctly but "%pylab" failed?

On my OS(Linux Mint Debian Edition 2), except for the system python(/usr/bin/python) installed by the apt, I also installed the anaconda. But I’ve encounterd a problem running the following code with the anaconda python # test.py import matplotlib.pyplot as plt import numpy as np x = np.array([0, 1]) plt.scatter(x, x) plt.show() The error is This application failed to start because…
Read more

Creating file and directory with same name

In Linux, why can’t I create a file and a directory with same name. Seeing following error when test file exists. $mkdir test mkdir: cannot create directory ‘test’: File exists $cd test bash: cd: test: Not a directory Source: linux

How to configure linking so that compiled binary finds libraries?

I’m compiling ffmpeg. Configuration: –prefix=/home/john/zope/engage/zeocluster/ffmpeg/parts/ffmpeg-build –extra-cflags=’-I/home/john/zope/engage/zeocluster/ffmpeg/parts/x264-build/include -I/home/john/zope/engage/zeocluster/ffmpeg/parts/ogg-build/include -I/home/john/zope/engage/zeocluster/ffmpeg/parts/theora-build/include -I/home/john/zope/engage/zeocluster/ffmpeg/parts/lame-build/include -I/home/john/zope/engage/zeocluster/ffmpeg/parts/faac-build/include -I/home/john/zope/engage/zeocluster/ffmpeg/parts/faad-build/include -I/home/john/zope/engage/zeocluster/ffmpeg/parts/vpx-build/include -I/home/john/zope/engage/zeocluster/ffmpeg/parts/vorbis-build/include -I/home/john/zope/engage/zeocluster/ffmpeg/parts/ffmpeg-build/include’ –extra-ldflags=’-L/home/john/zope/engage/zeocluster/ffmpeg/parts/x264-build/lib -L/home/john/zope/engage/zeocluster/ffmpeg/parts/ogg-build/lib -L/home/john/zope/engage/zeocluster/ffmpeg/parts/theora-build/lib -L/home/john/zope/engage/zeocluster/ffmpeg/parts/lame-build/lib -L/home/john/zope/engage/zeocluster/ffmpeg/parts/faac-build/lib -L/home/john/zope/engage/zeocluster/ffmpeg/parts/faad-build/lib -L/home/john/zope/engage/zeocluster/ffmpeg/parts/vpx-build/lib -L/home/john/zope/engage/zeocluster/ffmpeg/parts/vorbis-build/lib -L/home/john/zope/engage/zeocluster/ffmpeg/parts/ffmpeg-build/lib’ The build completes fine, and LD_LIBRARY_PATH=./parts/ffmpeg-build/lib:./parts/x264-build/lib ./parts/ffmpeg-build/bin/ffmpeg runs the binary. Why is that LD_LIBRARY_PATH necessary? Didn’t I already tell the compiler to link against these libraries? Source: linux

Create file using ‘grep’ and ‘man’ command

I need to create file, which content will be the output of command ‘man grep’, using ‘grep’. Also I need to use command ‘man’ with ‘col -b’ to save file as Text-Only. All of this must be in one command. I try to do like this: grep man grep | col -b > output.txt But it doesn’t work. Source:…
Read more