title: named does't start when using systemctl

text: I am having trouble getting named to start using systemd on the Fedora 18 Raspberry Pi spin. It starts, then a few moments later there is a timeout and it fails. If I run the commands in named.service by hand, named starts just fine. I don't know what the timeout is that systemctl is looking for or where it is being invoked. I have read the man pages for systemctl, systemd and others and I will continue to research this, but if anyone has any pointers, that would be great. Thanks. systemctl status named.service output:               named.service - Berkeley Internet Name Domain (DNS)               Loaded: loaded (/usr/lib/systemd/system/named.service; disabled)               Active: failed (Result: timeout) since Tue 2013-01-29 14:36:41 EST; 35min ago              Process: 4189 ExecStart=/usr/sbin/named -u named $OPTIONS (code=exited, status=0/SUCCESS)              Process: 4186 ExecStartPre=/usr/sbin/named-checkconf -z /etc/named.conf (code=exited, status=0/SUCCESS)              Process: 4183 ExecStartPre=/usr/libexec/generate-rndc-key.sh (code=exited, status=0/SUCCESS)          Jan 29 14:35:12 raspi.example.com named[4191]: all zones loaded     Jan 29 14:35:12 raspi.example.com systemd[1]: PID file /run/named/named.pid not readable (yet?) after start.     Jan 29 14:35:12 raspi.example.com named[4191]: running     Jan 29 14:36:41 raspi.example.com systemd[1]: named.service operation timed out. Terminating.     Jan 29 14:36:41 raspi.example.com named[4191]: shutting down     Jan 29 14:36:41 raspi.example.com named[4191]: stopping command channel on 127.0.0.1#953     Jan 29 14:36:41 raspi.example.com named[4191]: no longer listening on 127.0.0.1#53     Jan 29 14:36:41 raspi.example.com named[4191]: exiting     Jan 29 14:36:41 raspi.example.com systemd[1]: Failed to start Berkeley Internet Name Domain (DNS).     Jan 29 14:36:41 raspi.example.com systemd[1]: Unit named.service entered failed state        The named.service file               [Unit]     Description=Berkeley Internet Name Domain (DNS)     Wants=nss-lookup.target     Before=nss-lookup.target     After=network.target          [Service]     Type=forking     EnvironmentFile=-/etc/sysconfig/named     Environment=KRB5_KTNAME=/etc/named.keytab     PIDFile=/run/named/named.pid     ExecStartPre=/usr/libexec/generate-rndc-key.sh     ExecStartPre=/usr/sbin/named-checkconf -z /etc/named.conf     ExecStart=/usr/sbin/named -u named $OPTIONS     ExecReload=/bin/sh -c '/usr/sbin/rndc reload > /dev/null 2>&1 || /bin/kill -HUP $MAINPID'     ExecStop=/bin/sh -c '/usr/sbin/rndc stop > /dev/null 2>&1 || /bin/kill -TERM $MAINPID'     PrivateTmp=true     [Install]     WantedBy=multi-user.target


title: How to scp folders with nasty names using a shell function

text: I am trying to write a function that I will put on all my machines in order to make it easy to send files at a fixed place on my network. Here is my script so far. Some folder may have duplicates names on my machines, so I'm adding a uuid at the end of the folder name.               function putOnSG3() {     uuid=`uuidgen`     if [[ -d $1 ]]; then scp -rv "$1" shiny:/Volumes/Seagate3To/"$1.$uuid";     else echo $1 " is not a directory. Not copying.";     fi;     }      I'm invoking it like this:               $ putOnSG testFo\[l\}der      Here is the problem:               zsh:1: bad pattern: /Volumes/Seagate3To/testFo[l}der.d84abc26-501b-4f89-a636-518b4059a770      How can I manage these nasty filenames ? Target filesystem is case sensitive hfsplus, source filesystems are various extfs from Linux machines and NTFS.


title: Is there a way to make feh fade in between transitions?

text: I would like my desktop wallpaper to fade between transitions instead of a cut. Is there a way to do this with feh? Maybe using xcompmgr or compton? If not is there a way of doing it without changing to a different wm? I am using awesome at the moment.


title: How to run bash on CYGWIN

text: I have created following file with name test.sh               #!/bin/bash          name = "Elvin John Paul"     echo $name     echo ${name#* }     echo ${name##* }     echo ${name% *}     echo ${name%% *}      and I am getting some error as below. ![enter image description here](http://i.stack.imgur.com/JOehe.jpg) can anyone tell me what wrong I am doing?


title: VSFTP local user works, but PAM users Permission Denied

text: I am attempting to configure vsftp to use PAM to authenticate virtual users on my Arch server. It seems so straight forward, I must be missing something simple. ### Configuration   * local user virtualftp in group virtualftp   * folders /srv/ftp and /srv/ftp/test1 owned by virtualftp:virtualftp   * PAM user test1 password test1p in /etc/vsftpd_login.db /etc/pam.d/vsftpd               auth required pam_userdb.so db=/etc/vsftpd_login crypt=hash     account required pam_userdb.so db=/etc/vsftpd_login crypt=hash     session required pam_loginuid.so      /etc/vsftp.conf               anonymous_enable=NO     local_enable=YES     write_enable=YES     local_umask=022     dirmessage_enable=YES     xferlog_enable=YES     connect_from_port_20=YES     ftpd_banner=Welcome to MCID's FTP server.     chroot_local_user=YES     chroot_list_enable=YES     chroot_list_file=/etc/vsftpd.chroot_list     listen=YES     # nopriv_user=virtualftp          # SSL Configuration     # ssl_enable=YES     # allow_anon_ssl=NO     # force_local_data_ssl=NO     # force_local_logins_ssl=YES     # ssl_tlsv1=YES     # ssl_sslv2=YES     # ssl_sslv3=YES     # rsa_cert_file=/etc/ssl/certs/vsftpd.pem     # rsa_private_key_file=/etc/ssl/certs/vsftpd.pem          # Passive Port Range     pasv_min_port=49152     pasv_max_port=65534          # Added settings for PAM virtualftp logins     pam_service_name=vsftpd     guest_enable=YES     guest_username=virtualftp     virtual_use_local_privs=YES          # Private folders for virtual users     local_root=/srv/ftp/$USER     user_sub_token=$USER      Currently I can login with `sftp://theherk@sftp.example.com`, my local user just fine. However, if I attempt to login with test1, I get permission denied. What am I missing or confused about?


title: how to type linear algebra symbols

text: How do I type the symbols for linear algebra on Ubuntu? Are there any programs that use them? ( I understand this is trivial basket weaving. Whats the fastest way! )


title: Automatically apply module patch and compile kernel when updated?

text: I've recently applied a one-line patch to `drivers/bluetooth/btusb.c` in order to enable compatibility with my Bluetooth device. However, whenever I get a kernel upgrade, the patch will be lost until someone backports it (which isn't likely). Is there a way for me to run a script and patch each new kernel upgrade automatically? DKMS seems like a good solution, but I'm not sure how to set things up. I don't want to recompile the entire Linux kernel every time I get an update, but I'd like to apply that patch to the btusb module, recompile it, and insert it into my kernel on every update. How can I do this using the source obtained from `apt-get source linux-source-3.2.0`? What files do I need to copy over? The critical `make` call is `make M=drivers/bluetooth modules`, but this depends on other kernel utilities to be built first. How can I assemble a DKMS module for this? Details on how to apply the patch can be found here on Ask Ubuntu.


title: Who is setting http_proxy?

text: On an Ubuntu system with bash as the default shell for the interested user, the `http_proxy` environment variable is set to a specific value in a fresh GNOME Terminal. The `.bashrc` file for this user and the one common to all users are not setting this value. A recursive grep looking for the proxy specific value from the root file system is running, but will take hours to complete. What are the common places I can look at to know where this proxy value is set ?


title: Why does rm *(1)* remove all files in a directory?

text: I expected that:               $ rm *(1)*      would remove all files containing `(1)` in the name. I was wrong. It removed all files in the directory. Why?


title: How do I grep without leading whitespaces?

text: I'm greping through a large codebase, and leading whitespaces and tabulation seem to be quite annoying. Is there any way to get rid of it?               grep -R "something" ./      E.g, instead of:               foo/bar.cpp:                       qwertyuiosomethingoi     foo/bar/baz.h:                          43rfsgsomethingdrfg     bar/bar.cpp:            1234edwssomethingczd      I want to get something like:               foo/bar.cpp: qwertyuiosomethingoi     foo/bar/baz.h: 43rfsgdsomethingrfg     bar/bar.cpp: 1234edwssomethingczd      Or better:               foo/bar.cpp:   qwertyuisomethingooi     foo/bar/baz.h: 43rfsgdrsomethingfg     bar/bar.cpp:   1234edwssomethingczd


title: iptables: how to redirect outgoing, public ip traffic to localhost:6666, not touching private ips

text: I want all outgoing to traffic that is directed to a private IP (10.0.0.0 - 10.255.255.255, 172.16.0.0 - 172.31.255.255, 192.168.0.0 - 192.168.255.255) to be untouched. I want all other traffic redirected to localhost:6666 (where I am running a socks5 proxy). I'm not sure what I need to do to not touch the private IP traffic but for the public traffic do I:               sudo iptables -t nat -A PREROUTING -p tcp -i <interface> -j REDIRECT --to-ports 6666      am I on the right track? UPDATE: This did the trick:               echo "Flushing previous rules..."     iptables -t nat --flush          echo "Deleting and recreating the PUBPROXY chain..."     iptables -t nat -X PUBPROXY     iptables -t nat -N PUBPROXY          echo "Setting iptables to ignore traffic directed to private ips..."     iptables -t nat -A PUBPROXY -o lo -j RETURN      iptables -t nat -A PUBPROXY -m iprange --dst-range 10.0.0.0-10.255.255.255 -j RETURN      iptables -t nat -A PUBPROXY -m iprange --dst-range 172.16.0.0-172.31.255.255 -j RETURN      iptables -t nat -A PUBPROXY -m iprange --dst-range 192.168.0.0-192.168.255.255 -j RETURN           echo "Redirecting other traffic to socks5 proxy running at localhost:6666"     iptables -t nat -A PUBPROXY -p tcp -j REDIRECT --to-port 6666


title: How to use 32 bit compiled shared object (.so) file on 64 bit RHEL?

text: I have a shared object file libfault.so for my 32 bit compiled application on RHEL 6.4. I want to preload this file while starting my application. I have placed it in /usr/local/lib/ directory. But while starting the application, i am getting the following error.               ERROR: ld.so: object 'libfault.so' from LD_PRELOAD cannot be preloaded: ignored.      But, if i compile libfault.so in 64 bit and place in /usr/local/lib64/, I do not get the error. But the file is not doing its intended function since my application is 32 bit compiled.


title: LVS is not accessible from the outside

text:
I'm currently busy setting up a LVS - Linux Virtual Server:               root@debian1:~# ipvsadm -L     IP Virtual Server version 1.2.1 (size=4096)     Prot LocalAddress:Port Scheduler Flags       -> RemoteAddress:Port           Forward Weight ActiveConn InActConn     TCP  debian1.lan:http wlc       -> debian2.lan:http             Masq    1      0          1                -> debian3.lan:http             Masq    1      0          1               debian1.lan is my VIP. debian2 and 3 are running apache. I'm able to use `curl` to get content:               root@debian1:~# curl debian1.lan
debian2

This is the default web page for this server.

The web server software is running but no content has been added, yet.
           But when I access debian1.lan (10.0.0.171) using `firefox` from my windows computer I get a "The connection has timed out" message. Is it maybe possible that Virtualbox is messing up the LVS? (debian 1 to 3 are VM's in Virtualbox using a bridged adapter). I started `tcpdump` on my debian2 and I see packets (when I use `firefox`) although I'm not sure about the meaning:               root@debian2:~# tcpdump -s 0 -A tcp port http     tcpdump: verbose output suppressed, use -v or -vv for full protocol decode     listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes     13:07:05.725727 IP My-PC.lan.54663 > debian2.lan.http: Flags [S], seq 1738645408, win 8192, options [mss 1460,nop,wscale 2,nop,nop,sackOK], length 0     E..4.M@....-     ...     ......Pg......... .\...............     13:07:05.725755 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:06.722025 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:08.722729 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:08.723841 IP My-PC.lan.54663 > debian2.lan.http: Flags [S], seq 1738645408, win 8192, options [mss 1460,nop,wscale 2,nop,nop,sackOK], length 0     E..4.a@.....     ...     ......Pg......... .\...............     13:07:08.723849 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:12.722808 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:14.724158 IP My-PC.lan.54663 > debian2.lan.http: Flags [S], seq 1738645408, win 8192, options [mss 1460,nop,nop,sackOK], length 0     E..0.g@.....     ...     ......Pg.......p. .p...........     13:07:14.724179 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............     13:07:20.722805 IP debian2.lan.http > My-PC.lan.54663: Flags [S.], seq 184008166, ack 1738645409, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 4], length 0     E..4..@.@.%{     ...     ....P..     ...g.....9..p..............      Can somebody offer me a helping hint on what I may do or check next?


title: What standard shell command can evaluate escaped Unicode in a stream?

text: I'm looking for a pipeable command that will convert substrings in the form of ‘`\unnnn`’ to the actual characters. For example:               $ echo 'co\u00ebfficient' | what_command     coëfficient


title: Home folder with Windows + Mint dual boot

text: I am dual-booting Linux Mint 17 Cinnamon 64-bit and Windows 8.1 64-bit. Since I use both OSes to work with the same files, I am thinking what would be the best approach to read and write files using both OSes. I am considering to create a separate partition for such files. Since Linux can access and write files located in a Windows partition but the opposite is not true, then a NTFS partition should work well for the common files. But my question is: how do I "link" the folders on this new partition to Linux /home? In Windows, there is the concept of libraries, and it is possible to add any folder in your system to the useful "My Music", "My Videos", etc. in "My documents". Would it be possible to do something similar with Linux? Or do I really have to mount this partition every time I boot my system and manually navigate to its subfolders? Or yet, is there any better approach to deal with common files than what I am proposing?


title: Alternative for jq in debian wheezy to parse json in bash

text: In Ubuntu you can simply install jq               apt-get install jq       but on debian it is not in the repository. Is there an alternative commandline to parse a JSON string on the console? maybe you can achieve this with python like (fantasycode):               cat test.json | python 'parse_json(stdin)'


title: Concatenation of two fields of two files

text: I have two files : called `t1.txt` and `t2.txt`. The contents are : ### t1.txt               a     b     c      ### t2.txt               ab     bc     cd      Now I want to merge these two files line by line into t3.txt so that the t3.txt should look like : ### t3.txt               aab     bbc     ccd      Please help in getting the output using shell script.


title: LinuxMint doesn't recognize `Katakana/Hiragana` key in japanese keyboard

text: I installed `LinuxMint 16 Cinnamon` in a virtualbox environment. And set `Keyboard Layouts` `Japanese` in `Regional Settings`. But `Katakana/Hiragana` key that is obviously implemented in Japanese keyboard, is not recognized. There is no response if I hit the key on `xev` window. As far as I checked other keys are recognized properly. What should I do to enable the `Katakana/Hiragana` key?


title: Where can I find the list of [[ ]] options?

text: like               [[ -s file ]]     [[ -z string ]]      preferably on the web. I looked on the ldp site but couldn't find them The man page (`man [`) is helpful but I am looking for a more compact list.


title: Installing CoGrOO on Kile

text: Does anyone know if it is possible to install/include CoGrOO on Kile? CoGroo: http://cogroo.sourceforge.net/


title: Setup LDAP client on RHEL 6.5

text: I am preparing for RHCSA exams and trying to setup LDAP client on my RHEL 6.5 box I am connecting to the online testing LDAP server Here I don't understand the relationship among following 3 files, not sure if they all needed or not.               /etc/openldap/ldap.conf     /etc/pam_ldap.conf     /etc/nslcd.conf      Basically I just put same settings in all the files, with correct syntax. For example here is my /etc/nslcd.conf               uid nslcd     gid ldap     uri ldap://ldap.forumsys.com/     base dc=example,dc=com     binddn cn=read-only-admin,dc=example,dc=com     bindpw password     ssl no      I verified that there is connection from my local host to ldap.forumsys.com port 389 and when I tried `id euler` I see traffice between my pc and LDAP server but it just could not resolve user name from LDAP server. Again I am not even sure this is the correct way of verifying it. Any advice ?


title: can I make awk cut its input according to '\n'?

text: we all know that we can get the columns of a line using awk, but the columns is split by white spaces:               cat FileName | awk ' { print $1,$2,$3 .... }'      but what if we want to split the files according to '\n':   for example if we have this file:               Hi      Hello     Aloha      and we want to get the second word 'Hello' using 'awk' what should we do?


title: Fast and slow symlinks

text: From http://en.wikipedia.org/wiki/Symbolic_link#Storage_of_symbolic_links > Early implementations of symbolic links stored the symbolic link information > as data in regular files. The file contained the textual reference to the > link’s target, and an indicator[clarification needed] denoting it as a > symbolic link. > > This method was slow and an inefficient use of disk-space on small systems. > An improvement, called **fast symlinks** , **allowed storage of the target > path within the data structures used for storing file information on disk > (inodes)**. This space normally stores a list of disk block addresses > allocated to a file. Thus, symlinks with short target paths are accessed > quickly. Systems with fast symlinks often fall back to using the original > method **if the target path exceeds the available inode space**. The > original style is retroactively termed a **slow symlink**. It is also used > for disk compatibility with other or older versions of operating systems.   1. Does "allowed storage of the target path within the data structures used for storing file information on disk (inodes)" mean that a fast symlink stores the path of the linked file inside the inode of the fast symlink Does a fast symlink, as a file itself, actually only have an inode and has no file content? Does a slow symlink, as a file itself, have an inode and some file content which is the target path?   2. What does "if the target path exceeds the available inode space" mean? Is it correct that if a symlink to a file is a fast symlink, if and only if the symlink and the file are on the same file system?   3. Is there any command that can check if a symlink is a fast or slow one?    4. When a symlink has file content, what is the command to show the content of the symlink? (So that if a fast symlink doesn't have file content and a slow one has, we can verfiy that.)


title: How do you adjust other user's job priority?

text: Let's say your coworker started a very intense process and went home. It's occupying most of the CPU resources, and you can't do your stuffs because of it. If it was your own process, you could run 'renice' on it. If you don't have a root privilege, what are some things you can do to run your heavy processes alongside the coworker's process?


title: What are the exact differences between awk and cut with grep?

text: We know that we can get the second column of the line we want from a file using these two techniques:               awk '/WORD/ { print $2 }' filename      or               grep WORD filename| cut -f 2 -d ' '      My questions are:   * What are the differences between the two commands above?   * Which one has the best performance?   * What are the advantages of using `awk` over using `cut`, and vice versa?   * What options does `awk` give us over `cut` and vice versa?


title: File descriptor and fork

text: When a child is forked then it inherits parent's file descriptors, if child closes the file descriptor what will happen ? If child starts writing what shall happen to the file at the parent's end ? Who manages these inconsistencies , kernel or user ? when a process calls the `close` function to close a particular open file through file descriptor. In the file table of the process, the reference count is decremented by one. But since parent and child are both holding the same file, the reference count is 2 and after close it reduces to 1. Since it is not zero the process still continue to use file without any problem. See Terrence Chan UNIX system programming,(Unix kernel support for Files).


title: Does the suid bit have any meaning for device files?

text: Does the suid bit have any special meaning for device files in Linux ?


title: using gmake and make

text: My Makefile entry has this snippet:               ####### Compiler, tools and options          CC              =       cl     CXX             =       cl     LEX             = flex     YACC            = byacc     CFLAGS  =       -nologo -Zm200 /MD /NODEFAULTLIB:msvcrtd /map:"Debug/eta.map" -W3 -MD -Od  -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DNOCRYPT -DNOUNCRYPT -DGEO_LIB -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG     CXXFLAGS        =       -nologo -Zm200 -W3 -MD -O1  -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DNOCRYPT -DNOUNCRYPT -DGEO_LIB -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG     LEXFLAGS        =     YACCFLAGS       =-d     INCPATH =        -I"c:\qt\3.3.8\include" -I"." -I"zlib-1.2.3" -I"$(QTDIR)\include" -I"." -I"C:\Qt\3.3.8\mkspecs\win32-msvc"     LINK    =       link     LFLAGS  =       /NOLOGO delayimp.lib /DELAYLOAD:comdlg32.dll /DELAYLOAD:oleaut32.dll /DELAYLOAD:winmm.dll /DELAYLOAD:wsock32.dll /DELAYLOAD:winspool.dll /NODEFAULTLIB:"libc" /SUBSYSTEM:windows /incremental:no /LIBPATH:"$(QTDIR)\lib"     LIBS    =        "qt-mt338.lib" "qt-mt338.lib" "qtmain.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "imm32.lib" "winmm.lib" "wsock32.lib" "winspool.lib"     MOC             =       $(QTDIR)\bin\moc.exe     UIC             =       $(QTDIR)\bin\uic.exe     QMAKE           =       qmake     IDC             =       $(QTDIR)\bin\idc.exe     IDL             =       midl     ZIP             =       zip -r -9     COPY_FILE       =       copy     COPY_DIR        =       copy     DEL_FILE        =       del     DEL_DIR =       rmdir     MOVE            =       move     CHK_DIR_EXISTS =        if not exist     MKDIR           =       mkdir     INSTALL_FILE= $(COPY_FILE)     INSTALL_DIR = $(COPY_DIR)          ####### Files       Intentionally left out to reduce size          ####### Implicit rules          .SUFFIXES: .c .cpp .cc .cxx .C          {.}.cpp{}.obj::             $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<             $<             <<     {.}.cc{}.obj::             $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<             $<             <<     {.}.cxx{}.obj::             $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<             $<             <<     {.}.C{}.obj::             $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<             $<             <<     {.}.c{}.obj::             $(CC) -c $(CFLAGS) $(INCPATH) -Fo @<<             $<             <<     ####### Build rules          all: Makefile             $(TARGET) $(TARGET):  $(UICDECLS) $(OBJECTS) $(OBJMOC)              $(LINK) $(LFLAGS) /OUT:$(TARGET) @<<             $(OBJECTS) $(OBJMOC) $(LIBS)             <<               mocables: $(SRCMOC)     uicables: $(UICIMPLS) $(UICDECLS)          Makefile:             eta.pro  C:\Qt\3.3.8\mkspecs\win32-msvc\qmake.conf $(QMAKE) -o Makefile eta.pro     qmake:              @$(QMAKE) -o Makefile eta.pro             More rules ...      I get this error: (Why?)               Linux:~/edge/src/qt/utilities/app/eta> gmake     cl -c -nologo -Zm200 -W3 -MD -O1  -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DNOCRYPT -DNOUNCRYPT -DGEO_LIB -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -I"c:\qt\3.3.8\include" -I"." -I"zlib-1.2.3" -I"/home/sam/edge/qt4\include" -I"." -I"C:\Qt\3.3.8\mkspecs\win32-msvc" -Fo @<<     /bin/sh: -c: line 0: syntax error near unexpected token `newline'     /bin/sh: -c: line 0: `cl -c -nologo -Zm200 -W3 -MD -O1  -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DNOCRYPT -DNOUNCRYPT -DGEO_LIB -DQT_THREAD_SUPPORT -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -I"c:\qt\3.3.8\include" -I"." -I"zlib-1.2.3" -I"/home/sam/edge/qt4\include" -I"." -I"C:\Qt\3.3.8\mkspecs\win32-msvc" -Fo @<<'     gmake: *** [{.}.cpp{}.obj] Error 1


title: Running MATLAB on Linux with SGID

text: I want to run my matlab instance as a special group. I tried setting sgid on matlab-startup-script or (not exclusive) on MATLAB-binary. Both ways were not successful.   For example running `sudo chmod g+s matlab glnxa64/MATLAB` and `matlab` results in               /usr/local/MATLAB/R2013a/bin/glnxa64/MATLAB: error while loading shared libraries: libut.so: cannot open shared object file: No such file or directory      The given file has read and execute rights for root, group (same as sgid) and even world. Isn't that strange?


title: Override LDAP login shell for a specific user in RHEL

text: How in RHEL do I specify /sbin/nologin shell to limit a user to SFTP access only when their shell is determined by their LDAP profile? chsh only works with passwd file users I believe.


title: How to use -d in ntfsundelete?

text: As far as I can tell from the manpage of `ntfsundelete` getting a file back is done with e.g.               ntfsundelete /dev/sdb3 -u -m important.txt      which would undelete the file in-place. If I don't want in-place mode I see this option               -d, --destination DIR  Destination directory      but when I use it `-d /tmp/win` it thinks it is a regex. How should `-d` be used?


title: How to tell if mysterious programs in nethogs listing are malware?

text: This is what I see in Nethogs: ![Screenshot](http://i.stack.imgur.com/2or3H.png) I'm concerned about the listings with PID `?`, running as `root`. How can I find out what these are? I'm running Linux Mint 14. Please let me know what other information I should include.


title: Configuring Org-mode to open PDFs with evince

text: I'm starting to use `org-mode` to export text to LaTeX. My problem is that it opens the generated PDF with `ebook-viewer` (it is a EPUB, CHM reader) instead of using evince. _Question_ Does anyone know how to change this behaviour and configure `evince` to be the default viewer?


title: execute bash script inside .bashrc

text: Hi I am curious if it is possible to execute a bash script inside bash rc. It would seem to create a infinite loop unless there was some way to tell it to not try and start a new shell. Here is an example bash_script.sh:               #!/bin/bash     echo Hello World      .bashrc               export HELLO_WORLD=$(bash_script.sh)


title: Reference request: Porting linux on any ARM based board

text: I am looking for a book or any other source that helps me in understanding detailed procedure for porting Linux on ARM based boards from scratch. There are many articles on internet but I could not find a single complete reference describing the procedure from scratch.


title: How to get notified when svcadm restarts a service that died

text: I'm using svcadm to keep my node.js server running on Illumos, is there a way to get notified if svcadm restarts the server because it crashed? Specifically if the process went down on its own and not when I restart it. I'd like a script to run so I can send an email or raise an alert.


title: Increment xml files with bash

text: A good mate on a forum had helped me with creating this script but everything Ive thrown at it outputs wrong and I do not know why or what is the issue. I ran all my script in ubuntu's terminal if questioned as bash test.sh. My goal is to increment several .xml file's `process></process>` tags, but some files could have 1 to 100 tags. **Example:**                - jfksaJDFH      - <process>value=""</process>      - <process>value=""</process>      - <process>value=""</process>      - <process>value=""</process>      - jdhkjasdh      - <process>value=""</process>      - <process>value=""</process>      - <process>value=""</process>      - <process>value=""</process>      **After script:**                - jfksaJDFH      - <process>value="1"</process>      - <process>value="2"</process>      - <process>value="3"</process>      - <process>value="4"</process>      - jdhkjasdh      - <process>value="5"</process>      - <process>value="6"</process>      - <process>value="7"</process>      - <process>value="8"</process>      **Script:**               #!/bin/bash          dir="/mnt/Desktop/test/"          while IFS= read -r -d '' file     do         i=1         while IFS= read -r -u 3 line         do             if [[ $line = '<process></process>' ]]; then                echo "<process>value=\"$((i++))\"</process>"             else                echo "$line"             fi         done 3< "$file" > "$file.xml"     done < <(find $dir -type f -name \*.xml -print0)      when script above is ran removes last `<process>value=""</process>` **modify script to this:**               while IFS= read -r -d '' file     do         i=1         while IFS= read -r -u 3 line         do             if [[ $line = '<process></process>' ]]; then                echo "$line"             else                echo "<process>value=\"$((i++))\"</process>"             fi         done 3< "$file" > "$file.xml"     done < <(find $dir -type f -name \*.xml -print0)      **Output of file is this:**               <process>value="1"</process>     <process>value="2"</process>     <process>value="3"</process>     <process>value="4"</process>     <process>value="5"</process>     <process>value="6"</process>     <process>value="7"</process>     <process>value="8"</process>     <process>value="9"</process>     <process>value="10"</process>     <process>value="11"</process>     <process>value="12"</process>     <process>value="13"</process>     <process>value="14"</process>     <process>value="15"</process>     <process>value="16"</process>     <process>value="17"</process>     <process>value="18"</process>     <process>value="19"</process>     <process>value="20"</process>     <process>value="21"</process>     <process>value="22"</process>     <process>value="23"</process>      which in other words increments but removes all other content in the page.


title: Regex for phrase matching with case statement in ksh

text: I am trying to start or stop a service on AIX in ksh. I am trying to start to build in fool proofing for checking things like if the services is already down, etc. Here is my script               #!/bin/ksh               #################################################################################     #                        PARAMETERS & VARIABLES SECTION                         #     #################################################################################          DBI_LOC="DBI/InstallCollector/dbi_collector/bin"          #Put input option to upper case.     OPTION=$( echo "$1" | tr "[:lower:]" "[:upper:]" )          #################################################################################     #                              FUNCTION SECTION                                 #     #################################################################################          parseresults() {         typeset RESULT="$1"              if [ "${OPTION}" = "START" ] ; then             case "${RESULT}" in                  *)                     echo "Success"                 ;;             esac         else             case "${RESULT}" in                  DBI.(Collector is not running))                     echo "Collector is already down. Continuing..."                 ;;                 DBI.(performance data collector shutdown COMPLETE))                     echo "Success shutting down collector. Continuing..."                 ;;                 *)                     echo "Error shutting down the collector. Exiting with error."                     exit 1                 ;;             esac         fi     }               #################################################################################     #                             MAIN SCRIPT SECTION                               #     #################################################################################                    case "${OPTION}" in         "START")             echo "Starting the collectors..."             RESULT=$(ksh ~/${DBI_LOC}/start_dbi_collector.sh)             ;;         "STOP")             echo "Stopping the collectors..."             RESULT=$(ksh ~/${DBI_LOC}/stop_dbi_collector.sh)             ;;         *)             echo "Error: No Parameter specified. Must be either start or stop"             exit 1             ;;     esac          echo ${RESULT}     parseresults ${RESULT}          echo     echo      I can't seem to get it to match on the two DBI phrases. Both of those are possible outputs from their stop script. I want to consider those successes, but anything else a possible failure. I'm still learning regex (and its differences in Java vs ksh, etc.) so you'll have to excuse my rustiness. What am doing wrong? And in your answer could you please explain why mine doesn't work and the right answer does. (I'm a proponent of the whole if you teach someone to fish thing....) **EDIT:** I'm thinking it has something to so with the parenthesis. I have another script which had the same problem of hanging, but when I removed the parens, the function quite hanging. So my trick is still how to do matching on phrases....


title: bash while loop that breaks at a given file size

text: So, I bought this book called _Primes and Programming_ , and it's pretty tough going. Today I wrote this (simple) program from chapter 1:               #!/usr/bin/env python          import math          def find_gcd(a,b):         while b > 0:             r = a - b * math.floor(a/b)             a = b             b = r         return int(a)          if __name__ == "__main__":         import random, sys         while True:             print find_gcd(random.randrange(int(sys.argv[1])), random.randrange(int(sys.argv[2])))      ...and just now I called it like so:               ./gcd-rand.py 10000 10000 > concievablyreallyhugefile      ...and now I'm dreaming of a `bash` one-liner that breaks when concievablyreallyhugefile has reached a certain size. I guess it would look something like:               while $(du -h f) < 32M; do ./gcd-rand.py 10000 10000 > $f; done      ...but I have never written a while loop in `bash` before and I don't really know how the syntax works.


title: What is the difference between the output of TOP command and Oprofile?

text: In the `top` command one of the processes is always showing a CPU usage of 4 to 5%. But in `oprofile` the CPU usage is 0.004%. I do not understand this. And I also noticed that even when a process is in sleep state, the process has got some CPU usage. How is it possible?


title: Generic HTTP server that just dumps POST requests?

text: I am looking for a command line tool that listens on a given part, happily excepts every HTTP POST request and dumps it. I want to use it for testing purposes, i.e. for testing clients that issue HTTP POST requests. That means I am searching the counterpart to `curl -F` (which I can use to send test HTTP POSTs to a HTTP server). Perhaps something like `socat TCP4-LISTEN:80,fork,bind=127.0.0.1 ...` - but socat is not enough because it does not talk HTTP.


title: Hiding User from Last Command

text: Is there any way to hide a particular user's login entry from other users who run the `last` command?


title: Illegal float value "error" c-shell

text: I have a form made it with a couple of text boxes, in which I input floating numbers and use this number to sum with other text box and put the result in a label. I then input the values of the text boxes to a variable (xbiz and xbder) and I sum it for example I get then this result : xbiz = 5.2 xbder = 2.3 **My problem is when one of the text boxes is empty** (in blank) the script give me an error of "ILLEGAL FLOAT VALUE!" I mean if I am not input a value in any od the two variables How can solve this problem? Here is my code:               #FORM     echo "FG 999999" >> $gui_in     echo "FONT cbr18" >> $gui_in     echo "BG 901010" >> $gui_in     echo "LABEL LOCATINES" >> $gui_in     echo "FG 101090" >> $gui_in     echo "FONT cbr18" >> $gui_in     echo "BG 708787" >> $gui_in          echo "TEXT xbiz X_BOT_IZQ" >> $gui_in     echo "TEXT xbder X_BOT_DER" >> $gui_in          #Calculation     set varx = `echo " $xbder + $xbiz" | bc -l`               #After calculate the values of the two variables (xbder + xbiz) I use the result in the following line:          COM display_layer,name=comp,display=yes,number=1     COM add_pad,attributes=no,**x=${varx},y=${varx}**,symbol=${sizefido},polarity=positive,\     angle=0,mirror=no,nx=1,ny=1,dx=0,dy=0,xscale=1,yscale=1


title: how to tell if a partition is empty/unused

text: This is certainly a really easy question for you all I am sure. So I have Ubuntu (13.04) as the only OS mounted on my HDD. What I would like to do is re-partition my HDD so as to begin a LFS build.   Using `sudo fdisk /dev/sda`, and `p` for print partition table I get:               /dev/sda1 * ................................. 83 linux     /dev/sda2   ................................. 5 extended     /dev/sda5   ................................. 82 linux swap/solaris      I would like to use the swap space that is `/dev/sda5` as the swap space for the build so as to not have superfluous swap space. Also, I would like to build the system in an extended system so I can make logical partitions for `/boot`, `/`, `/usr`, et al. My question is, how do I figure out what is in the `/dev/sda2` partition? Is it empty? Is it available for me to build my LFS base in? If it is empty, then I won't partition anything. If it is being used by Ubuntu for something then I will have to build another primary partition for the build. Unfortunately I do not remember making the partition, if I did.


title: Install Chromium OS without USB Disk

text: You seem to need a 4GB USB disk or flash drive to install Chromium OS onto before you can install it to your hard drive. Is there a way to install Chromium OS onto your hard drive without a handy 4GB USB disk? It would be nice if I could dual-boot it with Linux or Windows as well.


title: List currently running cron tab and stop it

text: I created a cronjob, it runs for a very long time but now don't know how to stop it. Please help.


title: Appending to same array in various loops, only last values remain Bash 4

text: I have something like this:               FILES=()     for i in *.map     do         FILES+=($i)     done          find /var/candy -name "chocolate_[0-9]" | while read snack     do         FILES+=($snack)     done          for file in ../out/amsterdam/apples/{system.map,vmlinux}     do         FILES+=($file)     done      But the array ends up only containing `../out/amsterdam/apples/system.map` and `../out/amsterdam/apples/vmlinux`. What happened to the other values? I know they exist in those loops because I echoed to make sure the variables contained something.


title: How to enable force feedback in kernel 2.6.34 - 64 bit?

text: The wheel is `Logitech driving force DFGT`. The platform:               linux-dopx:/home/anisha/ # cat /etc/issue && uname -a      Welcome to openSUSE 11.3 "Teal" - Kernel \r (\l).     Linux linux-dopx 2.6.34-12-desktop #1 SMP PREEMPT 2010-06-29 02:39:08 +0200 x86_64 x86_64 x86_64 GNU/Linux      To check the force feedback I did:               linux-dopx:/home/anisha/ # fftest /dev/input/event4     Force feedback test program.     HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES          Device /dev/input/event4 opened     Axes query:     Effects:     Number of simultaneous effects: 0     Upload effects[0]: Function not implemented     Upload effects[1]: Function not implemented     Upload effects[2]: Function not implemented     Upload effects[3]: Function not implemented     Upload effects[4]: Function not implemented     Upload effects[5]: Function not implemented     Enter effect number, -1 to exit      fftest failed with `Function not implemented` message.   The wheel is being detected through event4 and js0 files in /dev/input/               # cat /proc/bus/input/devices     shows:     I: Bus=0003 Vendor=046d Product=c29a Version=0111     N: Name="Driving Force GT"     P: Phys=usb-0000:00:1d.3-1/input0     S: Sysfs=/devices/pci0000:00/0000:00:1d.3/usb5/5-1/5-1:1.0/input/input7     U: Uniq=     H: Handlers=event4 js0     B: EV=1b     B: KEY=1f0000 0 0 0 0 0 0 ffff00000000 0 0 0 0     B: ABS=30007     B: MSC=10      How to counter this? No, I am not running any game. I just wanted to apply these effects to my wheel. I even tried `modprobe hid-logitech` and `modprobe hid`, they didn't help. Please help.


This doesn't make sense to me, why would there be a load of 5 if there are zero processes in the runq?               12:00:01 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15     12:05:01 AM         0       708      5.23      5.14      5.10     12:15:01 AM         0       708      5.16      5.12      5.09     12:25:01 AM         0       708      5.07      5.07      5.08     12:35:01 AM         0       708      5.12      5.08      5.07     12:45:01 AM         2       708      5.18      5.15      5.09     12:55:01 AM         1       708      5.05      5.12      5.09     01:05:01 AM         0       708      5.06      5.08      5.08     01:15:01 AM         0       708      5.14      5.11      5.09      I know iowait is often the culprit for driving up the reported load, but there's very little disk activity,               12:00:01 AM       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz     await     svctm     %util     12:05:01 AM    dev8-0      1.53      0.00     30.61     20.01      0.00      0.34      0.21      0.03     12:15:01 AM    dev8-0      1.32      0.00     25.77     19.51      0.00      0.34      0.10      0.01     12:25:01 AM    dev8-0      1.60      0.00     40.81     25.43      0.00      0.64      0.29      0.05     12:35:01 AM    dev8-0      1.64      0.00     35.76     21.80      0.00      0.73      0.22      0.04     12:45:01 AM    dev8-0      1.33      0.00     25.95     19.51      0.00      0.23      0.12      0.02      The box itself is running a django instance and handling about 5 hits/sec.


title: Can I use my own ld.so.cache?

text: `ldconfig` has two interesting options:               -f conf           Use conf instead of /etc/ld.so.conf.     -C cache           Use cache instead of /etc/ld.so.cache.      I tried copying `/etc/ld.so.conf` to my own home directory, and edited it to include paths to my local libraries e.g. `/home/syockit/local/usr/lib` etc. And ran               ldconfig -f /home/syockit/ld.so.conf -C /home/syockit/ld.so.cache      and subsequently, to confirm that the libraries are cached, I ran               ldconfig -f /home/syockit/ld.so.conf -C /home/syockit/ld.so.cache -p | less      and it does include all my libraries on top of also including system libraries. Now, I want to have the default linker use these two. But in `man ld.so`, I see no mention of being able to use custom `.conf` or `.cache`. So what's the point of the above two options of `ldconfig` then?


title: Mount Drive Unplugged, Folder Still Writable

text: I created a folder using `sudo mkdir /mnt/external/` and then mount an external hdd to it:               $ mount -t ext2 /dev/sdd1 /mnt/external      I have an application writing backups to that mounted drive. Then, for fail test I simply unplug the external drive but the the application still keeps writing backups to that folder. This is a problem because `/mnt/external/` folder now becomes a regular folder on the regular hard drive and the application fills up the actual hard drive which is running the OS. How can I make sure that the application only writes to the mount point if the drive is currently mounted there?


title: replacing text and deleting text using awk in file using

text: I have a script and I want to do some replace and delete operations on it. I used `sed` to extract values between words `SendCommands` and `end` like this               sed -n '/SendCommands/,/end/p' ddtt      As `awk` was not giving me desired output so I'm sticking with this. I pasted the output here just show how it looks like :output `sed` is giving the function and comment part. How do I put multiple such occurrences in a file into an array and perform search and replace or delete one text/command at a time. Like delete `access-list 4 permit 10.59.230.14;\` or `service timestamps debug datetime msec localtime show-timezone;\` etc or replace `service timestamps debug datetime msec localtime show-timezone` or `service timestamps debug datetime msec localtime show-timezone` INFO: SendCommands is actualy a function used in the script


title: After updating sSMTP to version 2.61 I cannot send mail via gmail

text: I updated sSMTP to version 2.61 and now when I try to us it I receive the following error:               ssmtp: Cannot open smtp.gmail.com:587      I can connect via telnet to their address, but sSMTP seems to get tripped up and Im not sure what changed after the update. Here is the `ssmtp.conf`               root=XXXXX@gmail.com     mailhub=smtp.gmail.com:587     RewriteDomain=gmail.com     Hostname=localhost     UseTLS=YES     UseSTARTTLS=Yes     AuthUser=XXXXX     AuthPass=XXXXX     FromLineOverride=yes      Output when connecting via telnet:               [root@soupcan sbin]# telnet smtp.gmail.com 587     Trying 74.125.142.108...     Connected to smtp.gmail.com.     Escape character is '^]'.     220 mx.google.com ESMTP l7sm7330049igx.2 - gsmtp     quit     221 2.0.0 closing connection l7sm7330049igx.2 - gsmtp     Connection closed by foreign host.      And the output when I try to use `sSMTP`               [root@soupcan sbin]# /usr/sbin/ssmtp -v XXXXX@gmail.com < /home/user/Documents/Scripts/msg.txt     [<-] 220 mx.google.com ESMTP f5sm7367852igc.4 - gsmtp     [->] EHLO localhost     [<-] 250 CHUNKING     [->] STARTTLS     [<-] 220 2.0.0 Ready to start TLS     ssmtp: Cannot open smtp.gmail.com:587      **EDIT** Turning on debug logging I now see this, Im still digging:               SSL not working: certificate verify failed (20)      **EDIT 2** This has been resolved by adding the following to my `ssmtp.conf` file               TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt      Found information from HERE and HERE


title: Firefox unable to access domains defined in /etc/hosts if Network Manager is disconnected from a network

text: For developing web sites, I define test domains in /etc/hosts :               127.0.0.1 example.org      I can then access example.org in the browsers. However I when the Network Manager is not connected to any network, Firefox is not able to access `example.org`, it gives an error similar to DNS failure. It cannot even load the localhost, if I try to access it by the host name of my machine - i.e. `http://rohit-box`. I can access example.org, rohit-box, etc. in Chrome. I can also ping them successfully. Thus I have isolated the problem to Firefox. I am using Linux Mint 13 Cinnamon, Firefox 19. Edit - I also tried resetting Firefox from the Help menu. The issue persists.


title: Ctrl-s hang terminal emulator?

text: I came across a sentence in vimdoc:               Note: CTRL-S does not work on all terminals and might block                     further input, use CTRL-Q to get going again.      and this key indeed hangs my vim. I was thinking that it was the fault of vim, since there was no problem when I use `C-s`/`C-x C-s` in emacs nox. However just now when I was reading a manpage and pressed the `Ctrl-s`, it hangs `man` as well(I am setting `less` as the PAGER). So can someone tell me what's happening? The terminal emulators are `xterm` and `lxterminal`, and `tty` also has this problem. And a `Ctrl`+`q` puts the process right again in all the cases.


title: How to check if hot-swap or hot-plug are activated on my Linux machine

text: I have Ubuntu 12.04.1 LTS 64-bit on a PowerEdge 2900. My current setup has two 300GB disks (no RAID), but I want migrate the system to three new 600GB disks. I'm trying to connect the new disks, make a RAID5 array, and copy my partitions to the new RAID, but i'm not sure if the server has hot-plug support or, in particular, if it's activated. Looking at the system I get:               admin@host:~$ lsscsi -v     [4:0:0:0]    disk    HITACHI  HUS151414VLS300  A48B  /dev/sda       dir: /sys/bus/scsi/devices/4:0:0:0  [/sys/devices/pci0000:00/0000:00:05.0/0000:01:00.0/0000:02:08.0/host4/port-4:0/end_device-4:0/target4:0:0/4:0:0:0]     [4:0:1:0]    disk    HITACHI  HUS151414VLS300  A48B  /dev/sdb       dir: /sys/bus/scsi/devices/4:0:1:0  [/sys/devices/pci0000:00/0000:00:05.0/0000:01:00.0/0000:02:08.0/host4/port-4:1/end_device-4:1/target4:0:1/4:0:1:0]          admin@host:~$ lspci | grep '02:08.0'     02:08.0 SCSI storage controller: LSI Logic / Symbios Logic SAS1068 PCI-X Fusion-MPT SAS (rev 01)      LSI SAS 1068 has hot-swap support according to the description, but I'm not sure, and I can't power-off the system for migration or check in bios. I'm afraid to just connect a disk in case it damages the controller or the disk itself, so I need a way to check if hot-plug/hot-swap is activated in the system.


title: How to connect to port immedeately, avoiding socket_bind(): unable to bind address?

text: When running a code that is supposed to read from a TCP/IP port I often get the following message (depending exactly what language have been used):               socket_bind(): unable to bind address      I know that this happens when some other process listens to this port / is binded to this port (I do not know the exact phrase to describe), and therefore my code cannot listen to that port. However, it is _my code_ which I just stopped (by CTRL-C) that is blocking this port! There seem to be some timeout involved, and after waiting some time (about 30 seconds) I can start my code to listen on this specific port without problems. I would like to know:   * Why is the port still blocked although I have stopped the code?   * How can I force the system to release this port so I can restart my code and start listening to this port?


title: How to edit files in-place while performing operation on the values matching the searched pattern?

text: Given a list files containing random text and many datetimes in ISO format in it (e.g "2012-07-02T10:47:24+02:00"), how can I find all these datetimes and add 2 hours to each one ? Ideally a solution that takes into account the fact that a day is 24 hours would be great (i.e "02T23:15 + 2" should result in "03T01:15" and not "02T25:15") but in my case that's not a big deal. And let's ignore the possible timezone consequences, and consider this as a simple math operation. I already know how to do this in Python for instance, reading all files line by line and replacing the line when datetimes are found but I wonder if there is a more straightforward way of doing this, with awk or sed maybe ? Thanks!


title: Huawei modem change auto answer settings

text: Is there a way to change Huawei modem ATS0=1 command to be permanently set, so that there would not be need to send that command every time when modem is plugged in ? On each modem-plugin command is by default ATS0=0, that means that modem auto call answer is disabled.


title: Non-graphical tty's not stretching full screensize

text: on tty7 (graphical environment) nothing's wrong, I can enjoy the whole pixels of my screen which is the main thing. But here's something a bit annoying, when I switch on terminals from 1 to 6, the visual space is shrunk to get into the upper left corner of my screen leaving the rest unused. worth a million words : ![pretty boring](http://i.stack.imgur.com/55HZb.png) _How can I fix that ?_ **update :** here's an shot of my screen ![enter image description here](http://i.stack.imgur.com/lydiN.jpg)


title: Making a IRQ SMP Affinity change permanent

text: I have to change the smp_affinity of a interrupt permanently. The following code needs to be executed when the server reboots:               echo "1" > /proc/irq/152/smp_affinity_list     echo "2" > /proc/irq/151/smp_affinity_list     echo "3" > /proc/irq/150/smp_affinity_list     echo "4" > /proc/irq/149/smp_affinity_list     echo "5" > /proc/irq/148/smp_affinity_list     echo "6" > /proc/irq/147/smp_affinity_list     echo "7" > /proc/irq/146/smp_affinity_list     echo "8" > /proc/irq/145/smp_affinity_list     echo "9" > /proc/irq/144/smp_affinity_list     echo "10" > /proc/irq/143/smp_affinity_list     echo "11" > /proc/irq/142/smp_affinity_list     echo "12" > /proc/irq/141/smp_affinity_list     echo "13" > /proc/irq/140/smp_affinity_list     echo "14" > /proc/irq/139/smp_affinity_list     echo "15" > /proc/irq/138/smp_affinity_list     echo "16" > /proc/irq/137/smp_affinity_list      I've added these lines to the /etc/rc.local file but the changes are not applied to the system. I've also added echo "test" > /root/test which gets executed properly, so the rc.local file gets executed. The system is running Debian 6.0.


title: Output of which command used for input to cd

text: I would like to take the output of a which command, and cd to the parent directory. For example, say I have the following:               which someprogram      With output:               /home/me/somedirectory/someprogram      And I would like to cd to the directory that someprogram lives in:               cd /home/me/somedirectory      I'd like to accomplish this in one line. What is the most elegant, tricky, short way to do this?


title: Configure OpenWRT as repeater

text: At home I'd like to configure one of my wifi routers to serve as a WI-FI signal extender. Since my main router is OpenWrt-based (Backfire 10.1.3), I'd like to use it for that purpose. I've looked into the problem and found that there is "Access Point (WDS)" option available in wifi interface setup. I thought this looks promising, especially since I've managed to configure my other router in that mode, too. However switching that option "on" doesn't do a thing. I've tried manually adding BSSID of the other side (WDS client) to /etc/config/wireless, but it didn't work. I still don't know where to configure security settings for the networks to pair (my network is WPA2 encrypted). The modem that would become a WDS client isn't running OpenWRT and I'm unable to get it installed there, so I'm trying with its current OS. But still, the main issue is with configuring OpenWRT side. Any ideas? EDITED: Found this two links: http://wiki.openwrt.org/doc/recipes/atheroswds https://forum.openwrt.org/viewtopic.php?id=11849 The first one gives not too many information, the second is rather outdated. Doesn't seem to work :(


title: how implement patch for change a arbitrary Governor in linux

text: > **Possible Duplicate:**   >  Implementing patch for changing a CPU frequency governor I am beginner in linux.I want implement a patch for change a arbitrary Governor in linux.not important what Governor be it.I only want some example for this work.thanks


title: I want to use a bluetooth keyboard during initram

text: I use _encryption_ on my hard drive. To boot I need to _type a password_ during initram to _decrypt_ the root partition. I'm running Archlinux on a tablet PC _without physical keyboard_ (only Bluetooth). For now I need to carry a USB keyboard with me in case I need to reboot. Note that I'm not always connected at boot (so early-ssh or mandos are not viable solutions). Does anyone know how to use bluetooth at boot ? Has anyone tried ? Solutions for Debian and derivated are also welcome, though I like Arch's way. PS : I assume this may seem illogical to weaken the security of my device (see comment), but I'm a _movable target_ and I _harldy_ have to type this password. Moreover, were I so concern about security I **wouldn't draw my bluetooth keyboard at all** , I just _don't want_ the drive to be readable once the pc down.


title: Wi-fi connection failing on Arch Linux

text: I' ve just installed Arch Linux on my computer, I have some problems: If I write               # iwconfig      The result is               -bash: iwconfig: command not found      the same is with `ifconfig` instead if I try with               # wifi-menu      I have               Please install 'dialog' to use wifi-menu      I don't have a modem to connect wire. What should I do?


title: Can't Install/Update packages on newly installed CentOS

text: I installed CentOS6 and it is the first time. I tried to install/update packages. But I coudn't. Here is the output and it doesn't stop. How can I solve this?               [root@localhost suranga]# yum update     Loaded plugins: fastestmirror, refresh-packagekit     Loading mirror speeds from cached hostfile      * base: mirror.nus.edu.sg      * extras: mirror.nus.edu.sg      * updates: mirror.nus.edu.sg     base                                                     | 3.7 kB     00:00          http: //mirror.nus.edu.sg/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirror.nus.edu.sg/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //centosmirror.go4hosting.in/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //centosmirror.go4hosting.in/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //mirrors.ispros.com.bd/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirrors.ispros.com.bd/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //mirror.vietoss.com/CentOS/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirror.vietoss.com/CentOS/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //centos.vr-zone.com/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //centos.vr-zone.com/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //ftp.cuhk.edu.hk/pub/Linux/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //ftp.cuhk.edu.hk/pub/Linux/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.     http: //mirror-fpt-telecom.fpt.net/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirror-fpt-telecom.fpt.net/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')     Trying other mirror.


title: Losing wifi connection to access point after a few minutes (hostapd, dnsmasq, iptables)

text: I'm using a laptop as a wifi access point. Since this laptop has the proper hardware, I was able to use `hostapd`. I wanted to use DHCP and `iptables`/NAT forwarding instead of a bridge to have more control over the connection. I made a script to execute all commands. My devices are able to connect to the access point and have full access to the internet for the first few minutes. After this amount of time, no devices are able to connect to the access point anymore. The only way to re-establish a connection is if I reboot the laptop and relaunch the script. Here is my script:               #!/bin/bash     echo 1 > /proc/sys/net/ipv4/ip_forward          # Clear iptables Rules     iptables -F     iptables -t nat -F          # iptables Rules     iptables -A FORWARD -d 192.168.1.0/24 -o wlan0 -m state --state ESTABLISHED,RELATED -j ACCEPT     iptables -A FORWARD -s 192.168.1.0/24 -i wlan0 -j ACCEPT     iptables -t nat -A POSTROUTING -o p4p1 -j MASQUERADE          # Set wlan0 IP     ip addr add 192.168.1.1/24 broadcast 192.168.1.255 dev wlan0     ip link set wlan0 up          # Set DHCP     dnsmasq -C /dev/null >/dev/null 2>&1 --listen-address=192.168.1.1 --dhcp-range=192.168.1.2,192.168.1.200,12h          # hostapd     hostapd /etc/hostapd/hostapd.conf      Where `hostapd.conf` has the following content:               ctrl_interface=/var/run/hostapd     ctrl_interface_group=wheel     macaddr_acl=0     auth_algs=1     ignore_broadcast_ssid=0     wpa=3     wpa_key_mgmt=WPA-PSK     wpa_pairwise=TKIP     rsn_pairwise=CCMP     wpa_passphrase=testomesto     driver=nl80211     interface=wlan0     hw_mode=g     channel=1     ssid=osumi-0      Additional information:   * Network hardware: Broadcom Corporation BCM4311 802.11a/b/g (rev 01)   * Network subsystem: Dell Wireless 1490 Dual Band WLAN Mini-Card   * Network driver: b43-pci-bridge   * OS: Fedora 17 (up to date) Below is an image of an iPod showing correct IP and router information ![enter image description here](http://i.stack.imgur.com/rgSFG.png)


title: Screen cuts off beginning of long command when accessed through bash history

text: I'm using the default versions of bash and screen in OS X Lion. When I'm in a screen session and I scroll back through the bash history and I come to a command that is long enough to wrap. I might first type some command:               selassid@tem02:~$ ls ljmix/fiftyfifty_softsphere/T0.350/r2.43/0.565421311859c0.1     83279836214c0.144847759343/      That wraps properly as written above, but if I press up to access it via bash's history, the console displays only:               83279836214c0.144847759343/      So the prompt and the entire first line of the command is missing, which makes it difficult to edit; if I scroll back to the first line, it appears but it overwrites the last line of output. When I execute the command, the rest of the first line is displayed and everything looks as expected:               selassid@tem02:~$ ls ljmix/fiftyfifty_softsphere/T0.350/r2.43/0.565421311859c0.1     83279836214c0.144847759343/     total 1792     ...     selassid@tem02:~$       What's more curious, is that if use the history to access the long command but I don't execute it yet, then use any `C-a` screen command, like switching to another window and then back, or if I click out of my current terminal window and back into it, the history command is now displayed properly again. My `PS1='\u@\h:\w$ '` so there's nothing strange going on there. Is there a way to correctly show the whole command when using the history? I've tried playing with the screen wrap settings, but they only make things worse. `stty -a` shows:               speed 9600 baud; 46 rows; 80 columns;     lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl         -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo         -extproc     iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8         -ignbrk brkint -inpck -ignpar -parmrk     oflags: opost onlcr -oxtabs -onocr -onlret     cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow         -dtrflow -mdmbuf     cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;         eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;         min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;         stop = ^S; susp = ^Z; time = 0; werase = ^W;


title: How to mount an IronKey in OpenBSD?

text: Being that it's proprietary, maybe this isn't possible but I was wondering if anybody was successful at mounting one of these in OpenBSD. I mounted the two partitions the USB drive creates which are `cd1a` and `cd1c` (cd rom emulation). Then I installed fedora base and turned on linux emulation in sysctl. `ldd` reveals all dependencies met. Running `./ironkey` gives:               Unable to initialize IKDevCore      Some sort of weird fedora error? Can't find any info. If all else fails maybe I can reformat the drive and just use it as hardware encrypted storage holding softraid partitions.


title: Where in "/" should extra disks be mounted?

text: According to Wikipedia http://en.wikipedia.org/wiki/Unix_directory_structure http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard extra disks should not be mounted in `/mnt/` according to the first link, but doesn't seams so according to the second link. Both say thought that they shouldn't be in `/media`. **Question** So where should extra permanent disks be mounted?


title: Use & (ampersand) in single line bash loop

text: I have been using this command successfully, which changes a variable in a config file then executes a Python script within a loop:               for((i=114;i<=255;i+=1)); do echo $i > numbers.txt;python DoMyScript.py; done      As each `DoMyScript.py` itself takes about 30 seconds to run before terminating, I'd like to relegate them to the background while the next one can be spawned. I have tried what I am familiar with, by adding in an ampersand as below:               for((i=114;i<=255;i+=1)); do echo $i > numbers.txt;python DoMyScript.py &; done      However, this results in the below error: > -bash: syntax error near unexpected token `;'


title: How to replicate (fork) the current terminal

text: Say I am using terminal and have `ssh`ed to a remote machine and did something.   How do I create a new terminal tab (or window) so I still has everything from the previous terminal window without having to do the whole thing like `ssh`, `cd`, etc. - just like forking. Then I can start working in the new window separately from the previous one.


title: Installing Epson Stylus SX115 printer on Archlinux

text: I have a printer 'Epson Stylus Sx115' plugged into my USB port. It is detected because it is listed in `lsusb`               Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub     Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub     Bus 001 Device 002: ID 05ac:1006 Apple, Inc. Hub in Aluminum Keyboard     Bus 001 Device 003: ID 05ac:8507 Apple, Inc. Built-in iSight     Bus 004 Device 002: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)     Bus 004 Device 006: ID 04b8:084d Seiko Epson Corp. Stylus SX115     Bus 001 Device 006: ID 05ac:0221 Apple, Inc. Aluminum Keyboard (ISO)     Bus 001 Device 007: ID 05ac:0304 Apple, Inc. Optical USB Mouse [Mitsumi]     Bus 003 Device 002: ID 05ac:8242 Apple, Inc. IR Receiver [built-in]     Bus 003 Device 003: ID 05ac:0237 Apple, Inc. Internal Keyboard/Trackpad (ISO)     Bus 004 Device 004: ID 05ac:8213 Apple, Inc.       I have CUPS installed as well as Gutenprint and the Epson driver from Avasys. However, when adding a new printer CUPS does not detect it so I can't install it. CUPS seems to be working because it is detecting my network printer (Brother DCP). How can I install my Epson printer? PS: I tried disabling the `usblp` module but without result.


title: What determines the path where the system searches for a file?

text: I am trying to get npm to work. In the process, I seem to have two versions of it installed: A corrupt one installed in ~/bin, and another I just compiled and ran `make install` to put it in `/usr/local/bin/npm`. So, I moved the entire ~/bin folder into ~/old/bin ... but still when I run `npm` the system searches in ~/bin:               $ which npm     /usr/local/bin/npm     $ alias npm     -bash: alias: npm: not found     $ npm     -bash: /home/ubuntu/bin/npm: No such file or directory     $ echo $PATH     /home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games     $      What causes Ubuntu to look for npm in `~/bin/npm` ? I'm using Ubuntu 11.10. I don't know if the question is ubuntu-specific or not, it can be moved to askubuntu if needed. I do see ~/bin in the PATH, but as far I as understand this only means that if npm was present at ~/bin then it would have used it ... but why does bash insist to look for it specifically there? Why doesn't it find `/usr/local/bin/npm`, even though the `which` command does find it?


title: Executing piped commands in parallel

text: Consider the following scenario. I have two programs A and B. Program A outputs to stdout lines of strings while program B process lines from stdin. The way to use these two programs is of course > foo@bar:~$ A | B Now I've noticed that this eats up only one core hence I am wondering > Are programs A and B sharing the same computational resources? If so, is > there a way to run A and B concurrently? Another thing that I've noticed is that A runs much much faster than B, hence I am wondering if could somehow run more B programs and let them process the lines that A outputs in parallel. That is, A would output its lines, and there would be N instances of programs B that would read these lines (whoever reads them first) process them and output them on stdout. So my final question is Is there a way to pipe the output to A among several B processes without having to take care of race conditions and other inconsistencies that could potentially arise?


title: Trying to Open a Port using CentOS

text: (I'm new to this!) I'm running a virtual server running CentOS. I'm trying to run a server that listens on port 37760. The code I'm running executes successfully, so I run               netstat -lptu      To show a list of ports listening, and               tcp        0      0 localhost.localdomain:37760 *:*      LISTEN      15006/node      is one of the entries. However, when I go to ip:37760 in my browser, the connection times out! I'm sure it's very obvious, but some help would be very helpful!! Thanks


title: Shell Prompt Customization?

text: I have used oh_my_zsh (and tinkered with bash_it) on multiple systems and have generally been happy with it, though I hate it's auto-correction feature and generally turn it off. My usual shell is zsh and I really want just three things from my prompt:   1. Current directory/or pwd.   2. Git status and branch.   3. Color output from ls (on the ls command, not in the prompt). The rest is just bling and is often irritating. By using these shell scripts I am paying too much in cpu cycles for what I want. Any suggestions, either with using these scripts or as a separate shell script. I am OK with either zsh or bash. Thanks.


title: What program displays volume/screen brightness under KDE?

text: It seems there's some bug in KDE related to power management and after putting my netbook to sleep several times, plugging it in and out, the notification about screen brightness set to 100% doesn't want to vanish (and as I modify brightness through keys, another one spawns right on top of the previous one, both half-transparent, two sets of numbers). Now, I could just kill the superfluous process if I ever knew how it's named. The notification, being an overlay, is "transparent" to 'xwininfo' and the likes. There's a tad too many processes I don't know to start killing by trial and error. Sure restarting X would help but I'd like to get by without reopening my sessions in everything I have open. Once I know what to kill/restart I should be able to solve it (and if I can't restart it, so be it, better no brightness indicator than one stuck!) So, what's the name of the process that displays this: ? ![enter image description here](http://i.stack.imgur.com/lns2U.png)


title: Use grep to find all files in a directory with two strings

text: I am trying to figure out the correct syntax to find two strings, the entire part of each string, anywhere (doesn't have to be near each other) in a file. So any file that has both `foo` and say the number `321`, doesn't have to be alone and can be a substring should match. I've tried the following without much luck:               grep 'foo\|321' *          grep 'foo|321'


title: SSH -L Tunnel no longer working

text: Local machine running my scripts needs to access a remote server's DB. Last week I could do, on the local machine `ssh -f -N -T -L1081:localhost:3306 ueser@remoteserver -p2222` on the local machine:               # netstat -an | egrep "tcp.*:1081.*"     tcp        0      0 127.0.0.1:1081          0.0.0.0:*               LISTEN          tcp6       0      0 ::1:1081                :::*                    LISTEN      then telling my scripts to use port 1081 for mysql connections worked. This netstat command shows me im accepting connections fine on the local side but the same check on the remote machine the one with the actual mysql server is not listening in on 1081 at all, which wasn't the case before I checked sshd_config which seems to allow tunnelling, that is no config change. I also tried opening a tunnel to another server on my network and that's also not working, is my command crap or something? Tried with various combinations of `-f -T`


title: IPsec Tunnel mode - RoadWarriors configuration

text: I've the need to configure IPsec tunnel mode between a gateway with static NAT (let's say its public IP is `172.31.0.105`) and a number of clients that are behind dynamic NAT. Reading through some resources (as this, this, and this) I've found that the roadwarrior configuration should work for my case. I've properly managed to setup and start racoon in both my gateway and in a test client, and when I try to setup the vpn from the client (`racoonctl vc -u user 172.31.0.105`) I obtain the banner specified in the server. But somehow something it's wrong, and they cannot communicate. Here is the `racoon.conf` on the gateway:               path certificate "/etc/racoon/certs";          listen {             adminsock disabled;             isakmp 172.31.0.105[500];             isakmp_natt 172.31.0.105[4500];     }          timer     {             natt_keepalive 600 sec;     }          # Phase 1 configuration     remote anonymous {         exchange_mode aggressive;              my_identifier asn1dn;         certificate_type x509 "cert.pem" "key.pem";              proposal_check claim;         generate_policy on;         verify_cert off;              nat_traversal on;         dpd_delay 20;            ike_frag on;                   proposal {             authentication_method hybrid_rsa_server;             encryption_algorithm 3des;             hash_algorithm md5;             dh_group 2;         }     }          # Local network information     mode_cfg {         network4 172.31.0.200;             netmask4 255.255.255.0;            dns4 8.8.8.8;                      #wins4 10.0.12.1;                   pool_size 10;                       auth_source system;                 banner "/etc/racoon/motd";          pfs_group 2;     }                    # Phase 2 proposal     sainfo anonymous {         pfs_group 2;         lifetime time 1 hour;         encryption_algorithm 3des;         authentication_algorithm hmac_md5;         compression_algorithm deflate;     }      Here is the `racoon.conf` on the test client:               path certificate "/etc/racoon";     path pre_shared_key "/etc/racoon/psk.txt";          listen {         adminsock "/var/racoon/racoon.sock" "root" "operator" 0660;     }          # Here is the address of the VPN gateway     remote 172.31.0.105 {       exchange_mode aggressive;       ca_type x509 "cacert.pem";       proposal_check obey;       nat_traversal on;       ike_frag on;       mode_cfg on;       passive off;       verify_cert off;       script "/etc/racoon/phase1-up.sh" phase1_up;       script "/etc/racoon/phase1-down.sh" phase1_down;       proposal {         encryption_algorithm 3des;         hash_algorithm md5;         authentication_method hybrid_rsa_client;         dh_group 2;       }     }               sainfo anonymous {             pfs_group 2;             lifetime time 1 hour;             encryption_algorithm 3des;             authentication_algorithm hmac_md5;             compression_algorithm deflate ;     }      Here are the dump of the SPD entries, while the set of SAD entries is empty:               root@test-client:/etc/racoon# setkey -PD     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:49 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=267 seq=1 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:49 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=276 seq=2 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:49 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=283 seq=3 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:49 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=292 seq=4 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:50 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=299 seq=5 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:50 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=308 seq=6 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:50 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=315 seq=7 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: Jan  1 02:28:50 1970  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=324 seq=8 pid=2489         refcnt=1     172.31.0.200[any] 0.0.0.0/0[any] any         out prio def ipsec         esp/tunnel/192.168.66.105-172.31.0.105/require         created: May 23 13:30:05 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=345 seq=9 pid=2489         refcnt=1     0.0.0.0/0[any] 172.31.0.200[any] any         in prio def ipsec         esp/tunnel/172.31.0.105-192.168.66.105/require         created: May 23 13:30:05 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=352 seq=10 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: May 23 13:38:00 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=371 seq=11 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: May 23 13:38:00 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=380 seq=12 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: May 23 13:38:01 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=387 seq=13 pid=2489         refcnt=1     (per-socket policy)          Policy:[Invalid direciton]         created: May 23 13:38:01 2014  lastused:                              lifetime: 0(s) validtime: 0(s)         spid=396 seq=0 pid=2489         refcnt=1      The client succesfully setup a new network interface:               eth0:1    Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx                 inet addr:172.31.0.200  Bcast:172.31.255.255  Mask:255.255.0.0               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1      but when from the gateway I try to ping the client (or also to establish a netcat session) using this virtual IP (`172.31.0.200`) I get an               Destination Host Unreachable


title: Puppet, managing two depending file resources?

text: I cannot figure out, how to deal with case when I have 2 resources managed by puppet, depending on each other (one is parent of another), and both are set to be `absent`. Test case below. Directories doesn't exists already, but puppet complains about creating files there. How to fix this manifest?               $ find . -type f     ./modules/test/manifests/init.pp     ./modules/test/files/b/x     ./modules/test/files/b/z     ./modules/test/files/b/y     ./manifests/site.pp     ./test.pp     $ cat manifests/site.pp      ## site.pp          node default {         include test     }     $ cat modules/test/manifests/init.pp      ## init.pp          class test {         file { 'dir1':             ensure  => absent,             path    => '/tmp/a',             before  => File['dir2'],         }              file { 'dir2':             ensure  => absent,             path    => '/tmp/a/b',             source  => 'puppet:///modules/test/b',             force   => true,             purge   => true,             recurse => true,              }     }     $ puppet apply --modulepath ./modules manifests/site.pp     Notice: Compiled catalog for localhost in environment production in 0.11 seconds     Error: Could not set 'file' on ensure: cannot generate tempfile `/tmp/a/b/z20140523-14751-1qpqnds-9'     Error: Could not set 'file' on ensure: cannot generate tempfile `/tmp/a/b/z20140523-14751-1qpqnds-9'     Wrapped exception:     cannot generate tempfile `/tmp/a/b/z20140523-14751-1qpqnds-9'     Error: /Stage[main]/Test/File[/tmp/a/b/z]/ensure: change from absent to file failed: Could not set 'file' on ensure: cannot generate tempfile `/tmp/a/b/z20140523-14751-1qpqnds-9'     Error: Could not set 'file' on ensure: cannot generate tempfile `/tmp/a/b/y20140523-14751-1bxpkko-9'     Error: Could not set 'file' on ensure: cannot generate tempfile `/tmp/a/b/y20140523-14751-1bxpkko-9'     Wrapped exception:     cannot generate tempfile `/tmp/a/b/y20140523-14751-1bxpkko-9'     Error: /Stage[main]/Test/File[/tmp/a/b/y]/ensure: change from absent to file failed: Could not set 'file' on ensure: cannot generate tempfile `/tmp/a/b/y20140523-14751-1bxpkko-9'     Error: Could not set 'file' on ensure: cannot generate tempfile `/tmp/a/b/x20140523-14751-1u3y3dl-9'     Error: Could not set 'file' on ensure: cannot generate tempfile `/tmp/a/b/x20140523-14751-1u3y3dl-9'     Wrapped exception:     cannot generate tempfile `/tmp/a/b/x20140523-14751-1u3y3dl-9'     Error: /Stage[main]/Test/File[/tmp/a/b/x]/ensure: change from absent to file failed: Could not set 'file' on ensure: cannot generate tempfile `/tmp/a/b/x20140523-14751-1u3y3dl-9'     Notice: Finished catalog run in 0.14 seconds      EDIT: Full context:               ## init.pp          class test {              $is_master  = false              if $is_master {             $file_ensure        = present             $directory_ensure   = directory         } else {             $file_ensure        = absent             $directory_ensure   = absent         }              file { 'dir1':             ensure  => $directory_ensure,             path    => '/tmp/a',             before  => File['dir2'],         }              file { 'dir2':             ensure  => $directory_ensure,             path    => '/tmp/a/b',             source  => 'puppet:///modules/test/b',             force   => true,             purge   => true,             recurse => true,         }     }      You cannot remove dir1, because it'll fail on master, I need to make it works on master and slave.


title: How can I determine the cause of CF card corruption?

text: I installed qnx in my CF card and made it bootable and it was working well. However, yesterday it stopped working while my system was running. Checking the filesystem revealed that it was corrupted. I tried to view the log files but they are corrupted and inaccessible. How can I find out how it became corrupted and which files are corrupted with bit by bit. How can I view the hex file of cf card data. The card is using an ect2 filesystem.


title: File attributes does not exist in Linux?

text: There is no equivalent of Window's file attributes for Linux ?


title: Pass multiple commands to flock

text: flock -x -w 5 ~/counter.txt 'COUNTER=$(cat ~/counter.txt); echo $((COUNTER + 1)) > ~/counter.txt'      How would I pass multiple comands to `flock` as in the example above? As far as I understand, `flock` takes different flags (-x for exclusive, -w for timeout), then the file to lock, and then the command to run. I'm not sure how I would pass two commands into this function (set variable with locked file's contents, and then increment this file). My goal here is to create a somewhat atomic increment for a file, by locking it each time a script tries to access the `counter.txt` file.


title: Does tail read the whole file?

text: If I want to `tail` a 25 GB textfile, does the `tail` command read the whole file? Since a file might be scattered on a disk I imagine it has to, but I do not understand such internals well.


title: How to run a C program as a daemon?

text: I have a C program which I want to run as a daemon. How do I install it so it will run as a daemon on CentOS? Someone said to use `@reboot`, and some said to put it in `/etc/rc.d/rc.local`. Which is the right way?


title: Writing on NTFS drives (on Debian Wheezy)

text: I am currently setting up a personal server on Debian Wheezy. My machine is an ARM based architecture (Cubox). The problem appear when I want to mount and use my NTFS external hard drives. The mount point is correct, I can access files and folders, I can change owner but it is impossible to write files even as root. I mount my drives with "mount -o options source destination" The command mount gives rw option for this mounted drive.


title: How to copy the home directory in the home directory?

text: I need to make a copy of my home directory and place that copy in the same home directory. The exit code of the command must be `0`. Currently, my home directory does not contain any other directories. Is there a better way than the following? (pwd is the home directory)               mkdir /tmp/temp && cp * /tmp/temp && mv /tmp/temp .


title: Tab spacing in VIM

text: I want to change tab key spacing to 4 spaces in VIM editor on CVS server. I know the `:set tabstop=4` command is used for that but it does not have a permanent effect. After restarting VIM it changes to 8 spaces by default. I want to change it permanently. Thanks in advance.


title: MySQL aborting during initial db installation

text: Linux version:               shell> cat /proc/version     Linux version 3.2.0-4-686-pae (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.46-1+deb7u1      Installing MySQL 5.6.14 32-bit. I mostly followed the installation instructions from http://dev.mysql.com/doc/refman/5.6/en/unix-postinstallation.html:               shell> dpkg -i /home/user/mysql-5.6.14-debian6.0-i686.deb     shell> groupadd mysql     shell> useradd -r -g mysql mysql     shell> cd /usr/local     shell> ln -s  /opt/mysql/server-5.6/mysql     shell> cd mysql     shell> chown -R mysql .     shell> chgrp -R mysql .      When I run the installation script:               shell> scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/var/lib/mysql      I get this Error:               Installing MySQL system tables...2013-09-26 11:14:20 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.     2013-09-26 11:14:20 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).     2013-09-26 11:14:20 24642 [ERROR] Can't find messagefile '/usr/share/mysql/errmsg.sys'     2013-09-26 11:14:20 24642 [Note] InnoDB: The InnoDB memory heap is disabled     2013-09-26 11:14:20 24642 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins     2013-09-26 11:14:20 24642 [Note] InnoDB: Compressed tables use zlib 1.2.3     2013-09-26 11:14:20 24642 [Note] InnoDB: Using Linux native AIO     2013-09-26 11:14:20 24642 [Note] InnoDB: Not using CPU crc32 instructions     2013-09-26 11:14:20 24642 [Note] InnoDB: Initializing buffer pool, size = 128.0M     2013-09-26 11:14:20 24642 [Note] InnoDB: Completed initialization of buffer pool     2013-09-26 11:14:20 24642 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!     2013-09-26 11:14:20 24642 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB     2013-09-26 11:14:20 24642 [Note] InnoDB: Database physically writes the file full: wait...     2013-09-26 11:14:20 24642 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB     2013-09-26 11:14:21 24642 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB     2013-09-26 11:14:21 24642 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0     2013-09-26 11:14:21 24642 [Warning] InnoDB: New log files created, LSN=45781     2013-09-26 11:14:21 24642 [Note] InnoDB: Doublewrite buffer not found: creating new     2013-09-26 11:14:21 24642 [Note] InnoDB: Doublewrite buffer created     2013-09-26 11:14:21 24642 [Note] InnoDB: 128 rollback segment(s) are active.     2013-09-26 11:14:21 24642 [Warning] InnoDB: Creating foreign key constraint system tables.     2013-09-26 11:14:21 24642 [Note] InnoDB: Foreign key constraint system tables created     2013-09-26 11:14:21 24642 [Note] InnoDB: Creating tablespace and datafile system tables.     2013-09-26 11:14:21 24642 [Note] InnoDB: Tablespace and datafile system tables created.     2013-09-26 11:14:21 24642 [Note] InnoDB: Waiting for purge to start     2013-09-26 11:14:21 24642 [Note] InnoDB: 5.6.14 started; log sequence number 0     2013-09-26 11:14:21 24642 [ERROR] Aborting          2013-09-26 11:14:21 24642 [Note] Binlog end     2013-09-26 11:14:21 24642 [Note] InnoDB: FTS optimize thread exiting.     2013-09-26 11:14:21 24642 [Note] InnoDB: Starting shutdown...     2013-09-26 11:14:23 24642 [Note] InnoDB: Shutdown completed; log sequence number 1600607     2013-09-26 11:14:23 24642 [Note]      I've tried `touch /usr/share/mysql/errmsg.sys` with mysql ownership but that doesn't change anything. I can see that it is writing something to `/var/lib/mysql`               shell> ll /var/lib/mysql     total 110600     -rw-rw---- 1 mysql mysql 12582912 Sep 26 11:14 ibdata1     -rw-rw---- 1 mysql mysql 50331648 Sep 26 11:14 ib_logfile0     -rw-rw---- 1 mysql mysql 50331648 Sep 26 11:14 ib_logfile1     drwx------ 2 mysql mysql     4096 Sep 26 11:14 mysql     drwx------ 2 mysql mysql     4096 Sep 26 11:14 test      When I try:               shell> bin/mysqld_safe --user=mysql &      I get the exact same error output. I just dunno. Thanks for the help in advance.


title: Set alignment of numeric columns when columnating data

text: I use `column -t` to format data for easy viewing in the shell, but there seems to be no option to specify column alignment (e.g. align to the right). Any Bash one-liners to do it? I have arbitrary number of columns.


title: Using sed to match multiple possible environments in a file

text: I have some files numbered 01 to 24 that contain things like               \begin{thm}       blah blah blah     \end{thm}     \begin{lem}       blah blah blah     \end{lem}     \begin{prop}       blah blah blah     \end{prop}      inside of them and I want to extract every one of these matches from the file (together with the 'blah blah blah' of course). So I was happily using               sed -n '/\\begin{FOO}/,/\\end{FOO}/p' ./*.tex >> newfile.txt      and running the above with `FOO` replaced by `thm` then `lem` then `prop`. But I realised I am stupid because the order is all mixed up now in `newfile.txt` in the sense that all the `\begin{thm}...\end{thm}` precede all the `begin{lem}...\end{lem}` precede all the `begin{prop}...\end{prop}` even if they follow one another in one of the files say, but I want to keep them in the order that they appear in the files. > **Question:** How can I get `sed` to extract all of these case at once, and > thus preserve the order that they appear in the files?


title: error using yum in centos 6

text: my yum command used to work fine , but now , when I try to use it , it gives me an error :               file:///home/user/repo/repodata/repomd.xml: [Errno 14]      Could not open/read file:///home/user/repo/repodata/repomd.xml      I don't know what to do , please help me.


title: Patching a file (in this case dwm) and failed hunks

text: I'm trying to add the `transparency` patch to `dwm`. I downloaded the `.diff` file and in my dwm directory ran this:               max@linux-vwzy:~/misc/dwm/dwm-5.9> patch < dwm-transparency.diff      patching file config.def.h     patching file dwm.c     Hunk #1 FAILED at 58.     Hunk #5 succeeded at 306 (offset 1 line).     Hunk #6 succeeded at 847 (offset 27 lines).     Hunk #7 succeeded at 882 (offset 27 lines).     Hunk #8 FAILED at 1125.     Hunk #9 succeeded at 1558 with fuzz 1 (offset 2 lines).     2 out of 9 hunks FAILED -- saving rejects to file dwm.c.rej      I've patched `dwm` before to add a couple other patches. Is it possible that they are conflicting? Or is this another error?


title: zsh/Prezto: difficulties with right prompt alignment

text: This may be stupidly simple, but... I am trying to make my own prompt for Prezto. I have been using numerous prompts for reference (I can post a list if necessary). My RPROMPT and cursor are refusing to align correctly. I have done lots of Googling, and have found solutions such as zsh prompt not escaped properly and ZSH RPROMPT weird space. I have been through my code over and over again, making sure all literal escape sequences are surrounded by `%{ ... %}` and anything that takes up space is not. I have also used shellcheck.net to check for other kinds of errors. I suspect it has something to do with `prompt_segment` or `prompt_end`, because the misalignment occurs both when I enter a git branch and when log in as root (see screenshots). I've been working on this for ~~hours~~ ~~DAYS~~ **WEEKS** , and it's driving me nutsy!! The code is way too long to paste here, but is available on github. Screenshots are available in a gist.