« first day (1856 days earlier)      last day (3081 days later) » 

12:12 AM
man is your friend, reach him out
 
 
2 hours later…
2:24 AM
any regex experts around?
 
cas
@Seth, i'm pretty good at writing regexps. reading other people's REs is harder :)
but i'll give it a go.
 
this one should be super simple so :)
I'm trying to use wget to download a file with a know fist half but an unknown second.
(so this may also be a wget question I guess)
I can't figure out why $(date +%Y%m06)_me.*.mp3 isn't matching 20151106_me_egypt_plane_crash_probe_russia.mp3
 
cas
probably. unless the remote server understands and acts on regexes in URLs (AFAIK, none do), regex is kind of pointless with wget.
 
@cas Well (from what I read) that is what wget's -A flag is supposed to take care of.
 
cas
maybe. except that -A is for shell globs, not regexes.
so you want to exclude 20151106_me_egypt_plane_crash_probe_russia.mp3 from being downloaded?
does that (partial) URL actually exist on the remote site?
sorry, accept not exclude.
(anyway, that's a fixed string...not a regex or a glob)
ignore that last sentence. try $(date +%Y%m06)_me*.mp3 without the dot before the star.
in regex you need .* to mean "any number (incl. zero) of any characters". In glob it 's just *.
so that would be something like: wget -A "$BASE_URL/$(date +%Y%m06)_me*.mp3"
 
2:44 AM
sorry @cas, got called away.
 
cas
no prob, that's how chat is.
 
@cas yes it does, I can download it through the browser just fine.
The thing is, tomorrow it won't be "egypt_plane_crash"
 
cas
yes. did you try the glob i suggested?
 
just did, still 404 :/
Here is the entire command, for reference: wget -A "$(date +%Y%m06)_me*.mp3" http://pd.npr.org/anon.npr-mp3/npr/me/$(date +%Y/%m/)
 
cas
wget -A and -R are meant to be used with recursive wget options like -r to help refine what files will be downloaded. so maybe something like wget -r http://pd.npr.org/anon.npr-mp3/npr/me/ -A "$(date +%Y%m06)_me*.mp3" -R '*'. or maybe reverse the order of the -R and -A options.
 
2:52 AM
hmm, nope. Still 404. tried flipping -R and -A too.
this might just not work period.
 
cas
3:04 AM
the base url doesn't exist.
$ lynx -dump http://pd.npr.org/anon.npr-mp3/npr/me/
Not Found

The requested URL /npr/ht/17354/anon.npr-mp3/npr/me/ was not found on
this server.
 
well, that rules out directory listing
if you have a list of url's somewhere you can parse that @Seth
 
cas
The NPR site seems to have RSS feeds available for at least some of their podcasts. e.g. the "Two-Way" breaking news as a RSS link at the bottom of the page. unfortunately the urls it contains seems to use some google code as a spyware/tracking redirector.
s/as a RSS/has a RSS/
 
@Braiam nope :/
@cas The RSS feed doesn't seem to list the actual MP3 URL though.
 
cas
actually, looks like the RSS only has html links, not mp3
this task needs a web-bot. perl libwww-perl to the rescue!
(or python if that's what floats your boat)
 
I'm much better with python :P
well my solution isn't workable at all..
Here's the Q if anyone is interested: askubuntu.com/questions/695149/…
 
cas
3:24 AM
just because a URL ends with .../path/to/somewhere/filename.mp3 it doesn't mean that the parent directories are accessible (they may have access denined) or that they even exist as actual directories on a filesystem. they may be aliases or virtualised somehow with a script that parses the URL and fetches the filename.mp3 from a database or amazon S3 or something.
in situations like that, mirroring with wget or any other tool won't work. you need to write a web-bot that navigates the pages until it finds the mp3 URLs you're after and then downloads exactly those URLs.
i.e. URL paths don't necessarily reflect an actual filesystem. they can be whatever the remote server wants them to be.
 
hmm
@cas right, that's what I was afraid of.
 
cas
some sites can be real jerks about it, with link after link (and, worse, javascript links) because they don't want you directly downloading the files, they want you to suffer the godawful crappiness of their site in your browser (probably so they and google and the NSA and hundreds of other companies can spy on your web usage).
fortunately, web-bot libs like libwww-perl (LWP) can work around a lot of that crap.
there are probably equivs for python but i'm too lazy to look them up right now.
 
well thanks for the help @cas!
 
cas
mechanize seems to be the favourite tool for python.
urk! you made me go to AU to answer a question.
 
4:04 AM
@cas whoops, just saw that. I'm not actually the OP of that question :)
Thanks for all the help though. I still learned a lot ;)
@cas I don't know why AU gets so much hate :(
 
cas
because you have to wade through an enormous number of trash questions to find the gems.
 
one of the curses of being a big site..
 
cas
it's why i'd sort of like to see a Kali Linux SE. to provide a honeypit to entice the wannabe script kiddies to go there.
honeypot
 
you can edit your messages up to 2 minutes, @cas
(I'm freaking sure I'm pinging casey like mad...)
 
IKR, I was thinking the same thing.
Balpha is working on some chat pinging changes that should prevent that though.
 
4:09 AM
casey, go here and upvote all the things! meta.stackexchange.com/questions/268351/…
 
cas
4:19 AM
@Braiam, edit messages in chat? ah, right, so you can. didn't know that.
@seth just updated my answer on AU so it doesn't assume the OP is you.
 
cool :)
 
 
3 hours later…
7:43 AM
@cas Seconded.
 
8:11 AM
Does "cas" match both "cas" and "casey" then?
 
 
3 hours later…
 
3 hours later…
2:35 PM
Has anyone here got experience with Unix/Linux consulting?
 
 
2 hours later…
5:03 PM
well hello
first chat ive entered, ever!
 
5:28 PM
@Lennart Hi, but I'm afraid you picked one of the less active ones.
 
5:39 PM
@FaheemMitha yep.
 
I've asked this before, but any idea about:
Failed to create secure directory (/run/user/1000/pulse): Permission denied
@Seth That's a pain for casey.
 
Indeed.
 
 
2 hours later…
7:36 PM
so, graphics corruption is going strong in my new (not really) system
I should be blamed partly because using -experimental branch of firefox... but testing is just so freaking old!
 
 
1 hour later…
8:41 PM
@Braiam I've got black squares all over my browser. It's annoying.
 
cas
9:12 PM
@FaheemMitha - does /run/user exist? are its perms 1777 (drwxrwxrwt)? does /run/user/1000 exist? is it owned by uid 1000?
 
root@orwell:/home/faheem# ls -lah /run/user/1000/
total 0
drwx------ 7 faheem faheem 140 Oct 20 12:12 .
drwxr-xr-x 3 root root 60 Nov 8 08:11 ..
drwx------ 2 faheem faheem 60 Nov 3 13:44 dconf
drwx------ 2 faheem faheem 40 Oct 17 12:08 gvfs
drwx------ 2 faheem faheem 60 Oct 20 12:12 keyring
drwx------ 2 root root 80 Oct 17 12:08 pulse
drwxr-xr-x 2 faheem faheem 80 Oct 17 12:08 systemd
 
cas
what script is complaining about /run/user/1000/pulse ?
 
What should this look like?
@cas Well, I noticed it with arecordand mplayer, I think.
 
cas
well, /run/user/1000/pulse is owned by root. probably should be owned by faheem.
 
@cas Hmm. Is that how it is on your machine?
And why is it owned by root, anyway?
 
cas
9:15 PM
on my system, it's in /tmp/user/1000/pulse-PKdhtXMmr18n/ and is owned by cas
 
@cas Weird. Why is yours in a different place?
 
cas
why is it owned by root? my guess is you ran an audio player as root, maybe with sudo. and it created the pulse dir as root but only after checking the uid instead of the euid to get the tmpdir (/run/user/1000)
prob. different configuration. i'm running xfce on debian sid. what are you running?
 
@cas I see. Should I just change the owner/group, then?
 
cas
what's in the pulse/ subdir?
 
@cas You mean the distribution? Debian jessie/stable.
root@orwell:/home/faheem# ls -lah /run/user/1000/pulse/
total 4.0K
drwx------ 2 root root 80 Oct 17 12:08 .
drwx------ 7 faheem faheem 140 Oct 20 12:12 ..
srwxrwxrwx 1 faheem faheem 0 Oct 17 12:08 native
-rw------- 1 faheem faheem 5 Oct 17 12:08 pid
 
cas
9:18 PM
that'll probably fix it.
and desktop environment?
 
@cas Ok, I'll try that. Thanks.
@cas KDE. Whatever the jessie default is. Looks like 4.
 
cas
looks like the difference is a systemd vs sysvinit thing. my main desktop is sysvinit and has /tmp/user/1000/pulse-PKdhtXMmr18n. the myth frontend box next to my dialysis machine is systemd and has /run/user/1000/pulse, also owned by cas.
why systemd on that? so i've got at least one machine in the house running it (all the rest are sysvinit) to keep up-to-date with it. i'm resisting but eventually i'll probably have to switch to it. resistance is futile, i will be assimilated.
 
9:34 PM
@cas Hardcore anti-systemd then?
@cas Thanks for the assist. That error has gone now.
mplayer still has the error:
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
 
cas
10:31 PM
@FaheemMitha did you install the nvidia vdpau packages? can't remember what they are in stable (nvidia packages get renamed frequently), try apt-cache search -n vdpau.
in case you don't know, vdpau is nvidia's GPU video acceleration
 
10:54 PM
apt-file search libvdpau_nvidia.so
nvidia-vdpau-driver: /usr/lib/x86_64-linux-gnu/nvidia/current/libvdpau_nvidia.so.1
nvidia-vdpau-driver: /usr/lib/x86_64-linux-gnu/nvidia/current/libvdpau_nvidia.so.340.65
nvidia-vdpau-driver: /usr/lib/x86_64-linux-gnu/nvidia/current/libvdpau_nvidia.so.343.36
apt-get install -s nvidia-vdpau-driver
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libegl1-nvidia libgl1-nvidia-glx libgl1-nvidia-glx:i386 libgl1-nvidia-glx-i386:i386 libgles1-nvidia libgles2-nvidia libnvidia-eglcore libnvidia-ml1
libxnvctrl0 nvidia-alternative nvidia-driver nvidia-driver-bin nvidia-kernel-dkms nvidia-modprobe nvidia-settings xserver-xorg-video-nvidia
Suggested packages:
nvidia-kernel-dkms:i386 nvidia-kernel-source:i386
Is this safe to install? I'm running the nvidia legacy drivers.
dpkg -l | grep nvidia
ii glx-alternative-nvidia 0.5.1 amd64 allows the selection of NVIDIA as GLX provider
ii libgl1-nvidia-legacy-304xx-glx:am 304.125-1 amd64 NVIDIA binary OpenGL libraries (304xx legacy version)
ii libgl1-nvidia-legacy-304xx-glx:i3 304.125-1 i386 NVIDIA binary OpenGL libraries (304xx legacy version)
ii libgl1-nvidia-legacy-304xx-glx-i3 304.125-1 i386 NVIDIA binary OpenGL 32-bit libraries (304xx legacy version)
Yes, it says stuff like:
Recommends: nvidia-kernel-dkms (= 340.65-2) | nvidia-kernel-340.65
Suggests: nvidia-kernel-dkms (>= 340.65) | nvidia-kernel-source (>= 340.65)
Why can't it just do a conflicts?
 
11:15 PM
Hi
is terdon here ?
 
@Raja Yes, what's up?
Oh, and next time, ping me (@terdon) or I don't get notified.
 
Unless someone else notices... :P
 
@terdon Hi
 
@Fabby Hey, I had noticed already, I just thanked you so you'd feel useful. :P
@Raja What can I help you with?
 
@terdon :D
 
11:22 PM
@Raja OK, I just saw your comment. I don't really understand what you need or how it's related to the question. It might be better if you asked a separate question.
If it's simple, we can try and sort it out here, but asking questions is usually a better way.
@Raja?
 
@terdon Sorry for the delay , I am in office and issue came with server
so ...
can we work on the code here please
 
If it's simple, sure. What's the problem?
 
while read line; do v1=head -n 1 file1 | cut -d " " -f 1; v2=head -n 1 file1 | cut -d " " -f 2; echo "\"$v1"\=\"$v2"\"" >> file2 ; done < file1
its always giving me "name1"="key1" for total 3 times as 3 lines I got in that file
 
@Raja What file?
 
I dont want to use awk and sed
 
11:34 PM
And v1=head -n 1 file1 won't work, you need v1=$(head -n 1 file1) or:
 v1=`head -n 1 file1`
 
sorry , I mean a file named as file1 with content as
name1 val1
name2 val2
name3 val3
 
And what output do you want?
 
"name1"="val1"
"name2"="val2"
"name3"="val3"
@terdon I tried bro really... but I am not getting how to extract a single line everytime ... my code extracting everytime same line as I have given -n 1
 
Then why are you using head -n 1?
 
yes yes ... I have a thought of using iteration instead of 1
but that didnt work well
actually not at all
 
11:38 PM
 while read name val; do echo "$name=\"$val\""; done < file1 > file2
The read builtin can take more than a single variable.
I don't understand why you wouldn't want to use sed for this though. It will be much faster and simpler. The shell is not the best tool for parsing text.
 
while read name val; do echo "\"$name\"=\"$val\""; done < file1 > file2
you missed "" at name field bro
yeah yeah sed and awk you and other member shown how to achieve so I want to try with other commands I know of
 
@Raja No, I didn't. You don't want quotes on the left.
 
@terdon So read is playing main role here....so it can hold as many as variables.
As per OP , yes you are right
 
@Raja Yes. It automatically splits its input on whitespace (actually, on the contents of the $IFS variable but that's space, tab and newline by default).
 
ok
 
11:43 PM
   Reads a single line from the standard input, or from file descriptor FD
    if the -u option is supplied.  The line is split into fields as with word
    splitting, and the first word is assigned to the first NAME, the second
    word to the second NAME, and so on, with any leftover words assigned to
    the last NAME.  Only the characters found in $IFS are recognized as word
    delimiters.
That's from help read
 
@terdon I have one more question but I will google first and post if I dont find any
 
So, for example:
$ echo "a b c d" | while read v1 v2 rest; do echo -e "v1:$v1\nv2:$v2\nrest:$rest"; done
v1:a
v2:b
rest:c d
@Raja Try me.
 
@terdon , 1st you are awesome and 2nd
echo " All foo are boo " > file1
while read str1 str2 ; do echo "str1:$str1\nstr2:$str2";done
will give us , All
foo are boo
but is there any way i can get only 2nd string - foo and 4th string boo or some nth string
 
@Raja Yes, use awk. Or, if you insist:
while read str1 str2 str3 str4 ; do echo "str1:$str1\nstr4:$str4";done
 
so we must through reading all strings .
thats painful...:(
@terdon Thank you.
ttyl...office....
 
11:59 PM
@Raja Yes. Which is why you don't do this sort of thing in the shell usually.
 

« first day (1856 days earlier)      last day (3081 days later) »