dimanche 1 février 2015

Install python pip in Debian Wheezy


How to install pip in Debian Wheezy?


I've found many advises 'apt-get install python-pip' but the result is "Unable to locate package python-pip"


Is pip available in Debian Wheezy? I'm using 7.8


Thanks



KVM Disk Image File Path openSUSE


I need to enable networking for my guest VM but reading the manual, I need the default file path for the virtual disk image. Linux has such a complex file tree, I'm a bit lost!



Pipes, how do data flow in a pipeline?


I don't understand how the data flows in the pipeline and hope someone could clarify what is going on there.


I thought a pipeline of commands processes files (text, arrays of strings) in line by line manner. (If each command itself works line by line.) Each line of text passes through the pipeline, commands don't wait for the previous to finish processing whole input.


But it seems it is not so.


Here is a test example. There are some lines of text. I uppercase them and repeat each line twice. I do so with cat text | tr '[:lower:]' '[:upper:]' | sed 'p'.


To follow the process we can run it "interactively" -- skip the input filename in cat. Each part of the pipeline runs line by line:



$ cat | tr '[:lower:]' '[:upper:]'
alkjsd
ALKJSD
sdkj
SDKJ
$ cat | sed 'p'
line1
line1
line1
line 2
line 2
line 2


But the complete pipeline does wait for me to finish the input with EOF and only then prints the result:



$ cat | tr '[:lower:]' '[:upper:]' | sed 'p'
I am writing...
keep writing...
now ctrl-D
I AM WRITING...
I AM WRITING...
KEEP WRITING...
KEEP WRITING...
NOW CTRL-D
NOW CTRL-D


Is it supposed to be so? Why isn't it line-by-line?



when reinstalled windows 7 no such partition rescue mode grub>


On my laptop i have windows 7 and ubuntu,then i have reinstalled windows 7 home premium after finishing installation it went to rescue mode it says no such partition grub



Lost Win7 boot after installing UBUNTU Vivid


I have a dual boot system (Win7 for my company) and (UBUNTU 14.10) .. My company is using Encryption for the image of Win7. After Win7 installation i installed UBUNTU 14.10 and i was able to boot both. My HDD is partitioned as follows: 3 Primary partitions (c: for windows , D: , E: for data ) and 5 Logical partitions (3 data and 1 for Ubuntu and 1 for swap).


Firstly, (N.B. Problem_1) I noticed that from Ubuntu i'm unable to mount any of the primary partitions, but i can normally mount the other logical ones.


Secondly, (N.B. Problem_2) I decided to test Ubuntu Vivid 15.04 so i installed it on one of the logical partitions. After the installation i lost the Windows totally and i'm unable to boot to it, and from both Ubuntu versions, i'm unable to mount the primary partitions (ERROR: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error ) I used Boot Repair software on both Ubuntu versions, but none of them detected the Windows.


During boot of Ubuntu Vivid, it shows error (TPM error) and I understood that it is related to TPM Chip that is implemented for the security on Bios, i logged in to BIOS and disabled TPM option then the error disappeared.


I'm currently unable to boot from windows as it is not seen by Grub. And unable to mount the NTFS partition for windows.


If i understand well, this could be related to the security option done by the company that is preventing accessing the primary partition if the HDD is used outside the laptop, but at least i should be able to mount it even as Read-only or to boot from it in parallel with other OSs especially that it was working before and that i also disabled TPM.


Can anyone explain to me how to mount windows7 partition or to get its boot option back ?



sed: read whole file into pattern space without failing on single-line input


Reading a whole file into pattern space is useful for substituting newlines, &c. and there are many instances advising the following:



sed ':a;N;$!ba; [commands...]'


However, it fails if the input contains only one line.


As an example, with two line input, every line is subjected to the substitution command:



$ echo $'abc\ncat' | sed ':a;N;$!ba; s/a/xxx/g'
xxxbc
cxxxt


But, with single line input, no substitution is performed:



$ echo 'abc' | sed ':a;N;$!ba; s/a/xxx/g'
abc


How does one write a sed command to read all the input in at once and not have this problem?



Creating a shebang pointing portably to an interpreter in the folder of a script


I have a JS file (file.js) that I want to have executed as a command line shell script through nodejs (iojs actually); I'm using MINGW Git Bash on Windows.


The standard way to do it is to put the following shebang in the JS file:



#!/usr/bin/env node


However, I want to pass a cmd line flag to node to activate V8 harmony features, i.e. I want an equivalent of



node --harmony_arrow_functions file.js


when run just as



./file.js


without the need to pass the flag manually.


Using



#!/usr/bin/env node --harmony_arrow_functions


does not work.


After considering http://ift.tt/1zJNfOP and http://ift.tt/1uPiJLY I created the following solution:



$ ls
file.js nodeharmony.sh

$ cat nodeharmony.sh
#!/bin/sh
exec node --harmony_arrow_functions "$@"

$ head -1 file.js
#!/bin/sh nodeharmony.sh # or ./nodeharmony.sh, doesn't matter

$ ./file.js # this works fine


But the problem is that when I execute it from another folder, the shell tries to find nodeharmony.sh in the current working directory, not the directory of file.js:



$ cd ..
$ ./subfolder/file.js
/bin/sh: ./nodeharmony.sh: No such file or directory


Is there a way to create a portable shebang in file.js such that I can run file.js from whatever folder, without resorting to having my custom interpreter (nodeharmony.sh) available in the PATH?