Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
xPanda
Feb 6, 2003

Was that me or the door?
Hmm, this is odd. This computer also runs Win7, which doesn't appear to have any problems with dropped packets or the network in any way, so I'm reasonably confident that it isn't a cable problem.

However, ifconfig gives this output:
code:
eth0      Link encap:Ethernet  HWaddr 1c:6f:65:c1:58:df  
          inet addr:10.0.1.17  Bcast:10.0.1.255  Mask:255.255.255.0
          inet6 addr: fe80::1e6f:65ff:fec1:58df/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8089 errors:0 dropped:8089 overruns:0 frame:8089
          TX packets:8667 errors:0 dropped:69 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6436601 (6.4 MB)  TX bytes:1109154 (1.1 MB)
          Interrupt:41 Base address:0xc000
/var/log/syslog is putting out a heap of these:
code:
Jul  5 10:58:31 xander-ubuntu11 kernel: [ 1714.872015] r8169 0000:07:00.0: eth0: link up
Jul  5 10:59:29 xander-ubuntu11 kernel: [ 1772.417466] r8169 0000:07:00.0: eth0: link up
Jul  5 10:59:34 xander-ubuntu11 kernel: [ 1777.682401] r8169 0000:07:00.0: eth0: link up
Jul  5 11:01:18 xander-ubuntu11 kernel: [ 1880.677882] r8169 0000:07:00.0: eth0: link up
There's nothing else I can see in the logs which might be related. So it sounds like network manager. What can I do about that?

If it is at all relevant, the network chipset is Realtek RTL8111E, and lshw gives the following output:
code:
network
                description: Ethernet interface
                product: RTL8111/8168B PCI Express Gigabit Ethernet controller
                vendor: Realtek Semiconductor Co., Ltd.
                physical id: 0
                bus info: pci@0000:07:00.0
                logical name: eth0
                version: 06
                serial: 1c:6f:65:c1:58:df
                size: 1Gbit/s
                capacity: 1Gbit/s
                width: 64 bits
                clock: 33MHz
                capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
                configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full ip=10.0.1.17 latency=0 link=yes multicast=yes port=MII speed=1Gbit/s
                resources: irq:41 ioport:ee00(size=256) memory:fbeff000-fbefffff memory:fbef8000-fbefbfff
There's a slight mismatch with the chipset number. Could this possibly be a case of wrong driver?

fake edit: Ah, now that I was pointed in the direction of Network Manager, I was lead to this page: http://askubuntu.com/questions/46942/how-do-i-stop-my-ethernet-network-connection-from-dropping. I'll try this out.

update: Yep, those instructions fixed. Botched default driver for an incredibly common NIC chipset.

I gotta say, Ubuntu has made great strides since I started playing with it in 2006, but it's still these sorts of things which makes it a really frustrating experience. Some things are funny though. I'm migrating from OS X and am attempting to replicate Expose/Spaces/Window Management as closely as possible. Compiz is really cool, the only thing I'm having trouble with is binding keys to "expose" windows in the one application (F10 in OS X, you can kind of get it by Shift-clicking on the Launcher icon for an application) and switching between windows of the same application (Cmd-` in OS X, there is a setting for it in System Settings->Keyboard Shortcuts but it doesn't work). CSSM is a really good, if poorly presented, tool, but hilariously it's the only application I've encountered which stuffs up when using Grid-Maximise.
Also, changing the theme can make the text in the title bar invisible as you can't change the colour of the text in it independantly, and the nvidia driver installed through 'Additional Drivers' for a GTX570 does not detect multiple monitors.

xPanda fucked around with this message at 02:40 on Jul 5, 2011

Adbot
ADBOT LOVES YOU

SynVisions
Jun 29, 2003

Can someone explain this regex to me?

code:
.??*
This will match all dotfiles/dirs without matching . or .. but I don't understand the syntax and why it works.

I found this description of ?? on google:

Makes the preceding item optional. Lazy, so the optional item is excluded in the match if possible. This construct is often excluded from documentation because of its limited use.

However I still don't get it, can someone break it down for me? I think I'm getting mixed up due to the overloading of . and *, among other things.

Thanks!

SynVisions fucked around with this message at 20:57 on Jul 5, 2011

dont skimp on the shrimp
Apr 23, 2008

:coffee:
I'm not really experienced with regexp and such, but '?' works for single characters and it needs to be an actual character to match.

So, .??* would match anything that has a dot in the beginning, but also at least two other characters (thus excluding . and .., since they don't have enough characters).

I could very well be wrong though.

SynVisions
Jun 29, 2003

It seems like you're correct, because the regex doesn't pickup files such as:

.a

So the descriptions I've read of this online are false, it doesn't grab everything except for . and .. .

I got confused because it's based upon the preceding character in regex, but this seems to be a different usage.

SynVisions fucked around with this message at 21:15 on Jul 5, 2011

evol262
Nov 30, 2010
#!/usr/bin/perl
This seems odd (are you sure it's not '\.??*' ), but...

. -> matches any character
?? -> makes it optional (tries not to suck it in)
* -> match the preceding pattern zero or more times

As opposed to:

? -> makes it optional (greedy -- grabs it as part of the match if it can)

So:
.??* should match any string you dump in, really, since it'll reduce down to .* in 99% of cases.

code:
irb(main):026:0> test
=> "abc"
irb(main):027:0> test2
=> ".abc"
irb(main):028:0> test3
=> "."
irb(main):029:0> /.??*/.match(test).to_s
=> "abc"
irb(main):030:0> /.??*/.match(test2).to_s
=> ".abc"
irb(main):031:0> /.??*/.match(test3).to_s
=> "."
Reliably:

code:
^\.\w+?*
Or:

code:
^\.[^\.].+
What language is this?

evol262 fucked around with this message at 21:35 on Jul 5, 2011

brc64
Mar 21, 2008

I wear my sunglasses at night.
One of these days I will have to get around to learning regex beyond the most basic functions I know.

JHVH-1
Jun 28, 2002

brc64 posted:

One of these days I will have to get around to learning regex beyond the most basic functions I know.

The O'Reilly book Mastering Regular Expressions is pretty good. I learned a bit just going through it. Didn't use it for a long while and forgot most of it though. It covers the different flavors of regex, so not just perl.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

How much memory does an SSH tunnel use (roughly)?

I know there are some relatively low-end routers/firewalls that allow you to have 10-25 VPN users so I assume it's similar, and a fairly trivial amount of RAM.

I guess I could just fire up a server and watch top or something while I start connecting from random machines.

SynVisions
Jun 29, 2003

evol262 posted:

What language is this?

Sorry, I should have been more specific. It's probably not even technically regex.

This is at the shell level (bash in this case).

ls -ld .??*

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

SynVisions posted:

Sorry, I should have been more specific. It's probably not even technically regex.

This is at the shell level (bash in this case).

ls -ld .??*

In the shell, it's not a regex, it's a glob.

In globs, ? means "any single character" and * means "zero or more characters", so that matches any filename which begins with a dot followed by at least two characters.

dont skimp on the shrimp
Apr 23, 2008

:coffee:

ShoulderDaemon posted:

In the shell, it's not a regex, it's a glob.

In globs, ? means "any single character" and * means "zero or more characters", so that matches any filename which begins with a dot followed by at least two characters.
Shows just how little I know of regexp, heh. (I assumed regexp worked similar to globs :shobon: )

BnT
Mar 10, 2006

Bob Morales posted:

How much memory does an SSH tunnel use (roughly)?

I know there are some relatively low-end routers/firewalls that allow you to have 10-25 VPN users so I assume it's similar, and a fairly trivial amount of RAM.

I guess I could just fire up a server and watch top or something while I start connecting from random machines.

I thought that the limitations on firewall VPN sessions were not due to memory and more due to licensing profit or CPU in low-end hardware.

Looks like my VPS uses about 650KB of memory for a non-interactive SSH tunnel and more than 2MB with a full shell.

evol262
Nov 30, 2010
#!/usr/bin/perl

JHVH-1 posted:

The O'Reilly book Mastering Regular Expressions is pretty good. I learned a bit just going through it. Didn't use it for a long while and forgot most of it though. It covers the different flavors of regex, so not just perl.

Practically every language uses Perl Compatible Regular Expressions (PCRE), including Java and .NET, with minor syntactical differences. @"" in .NET, r'' in Python, and the like for raw strings, matching can be:
code:
Match re = new Regex(@".*").Match(somestring);
re.sub(r'.*', r'replace', somestring)
/.*/.match(somestring)
/.*/ =~ $somestring
etc...
But they all use the same basic syntax for the regex itself, it just comes down to how you call it.

The holdouts are mostly awk and shell scripting (my personal take being that you're better off using Perl for these cases anyway).

BnT posted:

I thought that the limitations on firewall VPN sessions were not due to memory and more due to licensing profit or CPU in low-end hardware.

Looks like my VPS uses about 650KB of memory for a non-interactive SSH tunnel and more than 2MB with a full shell.
CPU and memory both matter for VPN sessions, since the router needs to keep track of the state table/routing table and such for the VPN clients. 10-25 is a very real limitation if you have some consumer router with a 100Mhz CPU and 16MB of RAM.

brc64
Mar 21, 2008

I wear my sunglasses at night.
Okay, still ripping my DVDs with HandBrakeCLI, but I've got a couple that HandBrake is having difficulty determining the main title on. For whatever reason, this DVD contains 84 titles. Normally I've been using the command:

HandBrakeCLI -t 0 -i /media/cdrom

...to figure out for myself which title and chapters to select, but because there are so many, it's scrolling past the buffer in putty so I can't easily review the list to determine which ones I need. I'd like to redirect the output to a text file that I can quickly scroll through, so I tried:

HandBrakeCLI -t 0 -i /media/cdrom > dvd.txt

...but all that seems to do is give me a 0 byte file named dvd.txt. I also tried | more instead, but that didn't have any effect either.

I figure I must be missing something extremely simple, but I can't for the life of me figure out what it is.

Edit: removed DVD title just in case anybody complained

brc64 fucked around with this message at 17:11 on Jul 6, 2011

Computer viking
May 30, 2011
Now with less breakage.

It might be printing to stderr instead of stdout - try with &> instead of just > .
(I'm assuming this is bash or bash-like.)

FISHMANPET
Mar 3, 2007

Sweet 'N Sour
Can't
Melt
Steel Beams

brc64 posted:

Okay, still ripping my DVDs with HandBrakeCLI, but I've got a couple that HandBrake is having difficulty determining the main title on. For whatever reason, this DVD contains 84 titles. Normally I've been using the command:

HandBrakeCLI -t 0 -i /media/cdrom

...to figure out for myself which title and chapters to select, but because there are so many, it's scrolling past the buffer in putty so I can't easily review the list to determine which ones I need. I'd like to redirect the output to a text file that I can quickly scroll through, so I tried:

HandBrakeCLI -t 0 -i /media/cdrom > dvd.txt

...but all that seems to do is give me a 0 byte file named dvd.txt. I also tried | more instead, but that didn't have any effect either.

I figure I must be missing something extremely simple, but I can't for the life of me figure out what it is.

Edit: removed DVD title just in case anybody complained

It might be directing output to stderr instead of stdout, so look on how to redirect stderr into less (don't use more, more sucks, use less).

brc64
Mar 21, 2008

I wear my sunglasses at night.

Computer viking posted:

It might be printing to stderr instead of stdout - try with &> instead of just > .
(I'm assuming this is bash or bash-like.)
I learned a new trick!

That did exactly what I wanted. Now I suppose for true learning I should look up the difference between stderr and stdout to understand why that worked.

Computer viking
May 30, 2011
Now with less breakage.

Basically, you have one input channel (stdin), but two output channels (stdout and stderr). The idea is that programs can output the actual data on stdout, while status info, warnings, errors and the like go to stderr. Then, you can do "tool > file" or "tool | othertool" and the data goes in the file or into the next program, but the other stuff is printed on the console.

Sometimes, programs have weird ideas about what should go where, though.

brc64
Mar 21, 2008

I wear my sunglasses at night.

Computer viking posted:

Basically, you have one input channel (stdin), but two output channels (stdout and stderr). The idea is that programs can output the actual data on stdout, while status info, warnings, errors and the like go to stderr. Then, you can do "tool > file" or "tool | othertool" and the data goes in the file or into the next program, but the other stuff is printed on the console.

Sometimes, programs have weird ideas about what should go where, though.
That's pretty much what I read. I'm mostly trying to wrap my head around the functional difference between the two output streams, since both seem to output to the terminal as far as I can tell. Are they only really useful when using a program to differentiate and intercept them?

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

brc64 posted:

That's pretty much what I read. I'm mostly trying to wrap my head around the functional difference between the two output streams, since both seem to output to the terminal as far as I can tell. Are they only really useful when using a program to differentiate and intercept them?

You could re-direct stderr to a log file or something.

Computer viking
May 30, 2011
Now with less breakage.

Bob Morales posted:

You could re-direct stderr to a log file or something.
Or the opposite (output to file, error to console) - either way.

Basically, they're both just file handles a program can write to. When the shell starts a process, that process starts with stdout, stderr and stdin set by the shell. If you just run "tool", nothing special, then stdin is the keyboard, and stdout+stderr are both connected to the console output. The different things you can do in the shell can modify this: Using > will connect stdout to the given file. 2> connects stderr. &> connects both. If you do "tool1 | tool2", then stdout (but not stderr) from tool1 is connected to stdin in tool2, and I believe &| will connect both.

Put simpler, they aren't inherently different, it's just that they're typically used for different things - and the shell will join them together unless you tell it to separate them somehow.


edit: An example might be useful. I've got a python script lying around that will read two large text files, and extract some information from the combination. It writes the results to stdout, and progress info to stderr. In practice, that means I can run "mytool file1 file2 > results", getting both a clean data file and progress/debug information on the console while it slowly churns its way through. I could have swapped stdout and stderr in the program and done "mytool file1 file2 2> results" with the same result, but that's just being different for the sake of it.

Computer viking fucked around with this message at 20:30 on Jul 6, 2011

ExcessBLarg!
Sep 1, 2001

brc64 posted:

it's scrolling past the buffer in putty so I can't easily review the list to determine which ones I need. I'd like to redirect the output to a text file that I can quickly scroll through, so I tried:

HandBrakeCLI -t 0 -i /media/cdrom > dvd.txt
Another tip: you can also do:
code:
HandBrakeCLI -t 0 -i /media/cdrom | tee dvd.txt
to have the output both printed to the console and redirected to a file.

I realize the above example doesn't quite work for reasons already discussed, but you may find the general idea to be useful.

covener
Jan 10, 2004

You know, for kids!

ExcessBLarg! posted:

Another tip: you can also do:
code:
HandBrakeCLI -t 0 -i /media/cdrom | tee dvd.txt
to have the output both printed to the console and redirected to a file.

But be careful about adding this to scripts and blowing away the exit code!

Ziir
Nov 20, 2004

by Ozmaugh
How do I unrar a .rar file with a password from the command line if I know the password?

nitrogen
May 21, 2004

Oh, what's a 217°C difference between friends?

Ziir posted:

How do I unrar a .rar file with a password from the command line if I know the password?

it SHOULD ask you for the password:
code:
$ unrar x whatever.rar

Enter password (will not be echoed) for whatever.rar: 

Ziir
Nov 20, 2004

by Ozmaugh

nitrogen posted:

it SHOULD ask you for the password:
code:
$ unrar x whatever.rar

Enter password (will not be echoed) for whatever.rar: 

Can I apply the same password to more than one file so I can just forget about it and come back later?

covener
Jan 10, 2004

You know, for kids!

Ziir posted:

Can I apply the same password to more than one file so I can just forget about it and come back later?

have you tried passing the password on the command line as described in 'man unrar'?

Ziir
Nov 20, 2004

by Ozmaugh
I just started using cmus which has been awesome. Right now cmus just plays music through the laptop speakers that I have Arch installed on, but it would be nice if I could stream it over SSH or something. Is there another music player or something I could use to do this?

Also, what's the best way to manage music metadata on Linux/Arch? It'd have to be CLI only.

covener posted:

have you tried passing the password on the command line as described in 'man unrar'?

No, I couldn't figure out how to pass the same password through to the next rar file. Doesn't really matter anymore though cause I didn't have too many rar files anyway.

spankmeister
Jun 15, 2008






Ziir posted:

I just started using cmus which has been awesome. Right now cmus just plays music through the laptop speakers that I have Arch installed on, but it would be nice if I could stream it over SSH or something. Is there another music player or something I could use to do this?

You'd have to stream the sound over the network and tunnel the port used over SSH.
This can be done with VLC I think, which has a CLI version.

Underflow
Apr 4, 2008

EGOMET MIHI IGNOSCO

Ziir posted:

cmus

Thanks for the tip. Been after something like that for a long time.

angrytech
Jun 26, 2009
Does anyone know how to disable the error sound in thundebird?
One of my email accounts is making GBS threads itself, and I'm tired of getting the crap scared out of me whenever it refuses to take my password.

crazyfish
Sep 19, 2002

Ziir posted:

I just started using cmus which has been awesome. Right now cmus just plays music through the laptop speakers that I have Arch installed on, but it would be nice if I could stream it over SSH or something. Is there another music player or something I could use to do this?

Could you mount the music directory over sshfs?

Rocksteady
May 14, 2002
I'm having a problem trying to set my VGA output on my laptop, connected to a 1080p 22" lcd. 1440x900 works fine, but trying "xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync" I get a horizontally squashed picture, leaving large black spaces on either side. The TV's internal resolution display says it's in 1920x1080 mode.

edit: just discovered it likes "1600x900_60.00" in software, while the tv firmware reports 1440x900?

Rocksteady fucked around with this message at 06:23 on Jul 9, 2011

telcoM
Mar 21, 2009
Fallen Rib

evol262 posted:

You'll probably want to actually configure ldap.conf, but does this look like a problem to you?

<SSL certificate not trusted>

What if you don't bind with TLS/SSL?

Is there a cert out there somewhere from your university that you can grab?

You can get the certificate of just about any TLS/SSL service (i.e. the publicly-accessible part of it, not the private key) using the "openssl s_client" command. This is useful if you need to set a certificate as trusted, but you don't know where to find the certificate.

For example, in this case you might use:
code:
openssl s_client -connect ldap.university.org:636 </dev/null
(The "</dev/null" part is because you probably don't actually want to start typing in LDAP protocol messages manually: we're only interested in the SSL/TLS session set-up here.)

You'll get a long output, which will include something like this in the middle:
code:
Server certificate
-----BEGIN CERTIFICATE-----
MIIGEDCCA/igAwJBAgIBCjANBgkqhkiG9w0BAQUFADCBmzEkMCIGA1UEAxMbTWF0
dGkgS3Vya2VsYSBQcml2YXRlIEMBIEcyMQ4wDAYDVQQIEwVFc3BvbzELMAkGA1UE
<several more lines of alphabet soup here>
-----END CERTIFICATE-----
This is the server's SSL/TLS certificate in PEM format: you can copy/paste it to wherever you need it.

Here are some instructions for setting up a certificate as trusted for OpenSSL and all the tools that use the OpenSSL library (including OpenLDAP tools and PHP):

http://gagravarr.org/writing/openssl-certs/others.shtml

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

I hosed UP REAL BAD

Somewhere along the line, I changed my root user shell to /bin/nologin :haw:

It's a Debian box, there's no sudo. I can still login as other users. I can't scp or ssh in, and doing 'su -c whatever' or 'su -s /bin/sh' doesn't do anything (like the man page says)

Any ideas? It's a remote box otherwise I'd just drive to the office and fix it by hand.

How can I modify the /etc/passwd file, or run an editor as the root user?

enotnert
Jun 10, 2005

Only women bleed

Bob Morales posted:

I hosed UP REAL BAD

Somewhere along the line, I changed my root user shell to /bin/nologin :haw:

It's a Debian box, there's no sudo. I can still login as other users. I can't scp or ssh in, and doing 'su -c whatever' or 'su -s /bin/sh' doesn't do anything (like the man page says)

Any ideas? It's a remote box otherwise I'd just drive to the office and fix it by hand.

How can I modify the /etc/passwd file, or run an editor as the root user?

Eh, do you have remote console capabilities, so you can see the entire boot process and what not?

If so, try single user mode

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

enotnert posted:

Eh, do you have remote console capabilities, so you can see the entire boot process and what not?

If so, try single user mode

No, all I can do is ssh in as a regular user.

Computer viking
May 30, 2011
Now with less breakage.

Bob Morales posted:

No, all I can do is ssh in as a regular user.

If you can neither su, sudo or remote-console, I believe your watercraft has run low on paddles...

ExcessBLarg!
Sep 1, 2001

Bob Morales posted:

I hosed UP REAL BAD
What version of Debian and how up-to-date is it?

If it's out of date with regard to the latest security patches, your best bet at this point might be to run a local root exploit from your user account, fix up /etc/password or add /bin/nologin to /etc/shells, then su properly and clean up the mess.

Adbot
ADBOT LOVES YOU

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

ExcessBLarg! posted:

What version of Debian and how up-to-date is it?

If it's out of date with regard to the latest security patches, your best bet at this point might be to run a local root exploit from your user account, fix up /etc/password or add /bin/nologin to /etc/shells, then su properly and clean up the mess.

Yea, I started searching for some sort of shellcode.

It's pretty up to date, though.
debian_version is 6.02
Kernel 2.6.32-5-686

I have gcc and everything so I should be able to find something.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply