All your (http,https) traffic belongs to squid

phoe6: hello, I have setup a squid proxy running at port 3128; I want all my HTTP as well as HTTPS to proxy to through this one only. what should I do? (the tutorials are too wide and I think I am impatient too :( )

rob0: um, hire someone to do it for you?

phoe6: :) well, it is just two lines rob0. :) I am trying it out.,

phoe6: Sorry, if I sounded offending with the question. Let me try it and ask specific quesitons.

rob0: np, that is how to do it: try things, read manuals, ask specific questions when you get stuck.

phoe6: well I just had to write a filter rule to accept packets through squid-user and any traffic to port 80, pot 443 to reject. by this way my browsing is through squid proxy only.


$iptables -t filter -A OUTPUT -m owner --uid-owner 13 -j ACCEPT
$iptables -t filter -A OUTPUT -p tcp --dport 80 -j REJECT
$iptables -t filter -A OUTPUT -p tcp --dport 443 -j REJECT


Helpful entry: http://stuvel.eu/transproxy

Manually removing a corruped .deb install

I was getting this error, on a corruped install of a debian package.
""The package 'printers-bangalore' is in an inconsistent state and needs to be reinstalled, but no archive can be found for it. Please reinstall the package manually or remove it from the system"

To solve this issue, I followed these steps.

1) I edited /var/lib/dpkg/status and remove all references of that package. (Note that this is a tricky step; in my case it was simple)

2) sudo dpkg --configure -a

World's longest domain name

Some Trivia. I liked the pi value domain name.

BTW, it goes like this:
1) Each domain name can be maximum upto 63 octets. (Octets is 8bits; can safely be considered 1 English Character).
2) The sub-division of domains like (cs.univ.edu;math.univ.edu) can go upto 127 levels.
3) But the entire domain name may not exceed 253 octets.

So, if we are to search for the longest domain name (including sub-domains), we will end up with 253 english character long string. ( That would be like a page of characters). :)

Upgraded Ubuntu from 8.10 to 9.04

This was on my Thinkpad T400 laptop, where Ubuntu is installed through Wubi.

After upgrade, X could not start. No GUI No Window Manager.

Followed the steps mentioned here.

The problem was with fglrx driver.

1) Go to Recovery mode during boot.
2) Choose to drop into Shell with networking support

and do

sudo apt-get remove xorg-driver-fglrx


Reboot. It started working for me.

First thing you will notice in 9.04 is the notification system it has. Nice eye candy stuff.

Upgraded to Ubuntu 8.10 from 8.04

Used the Update Manager from the System-> Administration menu.

* Attempts to update through Indian Servers failed.
* There were constant interview dialogues. I got to look out for a configuration file, which can provide an interrupted/quiet upgrade.

Setting up http redirect

I was trying to setup a http redirect on ubuntu. Spent quite some time.
1) Ubuntu has a
/etc/apache2/sites-available/default
file where you will have to change the AllowOverride option from None to All.
Only this step will enable you to use .htaccess file.
2) In the .htaccess file, I was doing

Redirect 302 ./index.html http://localhost/new.html


Spent more than a hour to figure out, why the redirect is not happening. The problem was, I was doing
./index.html
instead of just
/index.html

Bytes and String in Py3k

Martin's Explaination:

It's really very similar to 2.x: the "bytes" type is to used in all
interfaces that operate on byte sequences that may or may not represent characters; in particular, for interface where the operating system deliberately uses bytes - ie. low-level file IO and socket IO; also for cases where the encoding is embedded in the stream that still needs to be processed (e.g. XML parsing).

(Unicode) strings should be used where the data is truly text by
nature, i.e. where no encoding information is necessary to find out
what characters are intended. It's used on interfaces where the
encoding is known (e.g. text IO, where the encoding is specified
on opening, XML parser results, with the declared encoding, and
GUI libraries, which naturally expect text).

- base64.encodestring expects bytes (naturally, since it is supposed to
encode arbitrary binary data), and produces bytes (debatably)
- binascii.b2a_hex likewise (expect and produce bytes)
- pickle.dumps produces bytes (uniformly, both for binary and text
pickles)
- marshal.dumps likewise
- email.message.Message().as_string produces a (unicode) string
(see Barry's recent thread on whether that's a good thing; the
email package hasn't been fully ported to 3k, either)
- the XML libraries (continue to) parse bytes, and produce
Unicode strings
- for the IO libraries, see above