braceRx = re.compile( R"[{}()]" )
text = sys.stdin.read()
hits = braceRx.findall(text)
print len(hits)
[Ben] Jeez. Pythoneers. Always making things more complicated. :)
perl -0wne'print y/{()}//' file.c
____________________________________________________
JPEG to PS
Kapil Hari Paranjape ([87]The LG Answer Gang)
Readers who wish to convert JPEG to Postscript for inclusion in a TeX/LaTeX
document (or for any other reason) may want to use:
convert file.jpg eps2:file.eps
^
Note the 2! This is better than the default "convert file.jpg file.eps" and
performs the same function as "jpeg2ps" (which is in [88]Debian non-free).
Explanation: The default postscript level for PS conversion is 1 which
produces large and bad conversions since it produces pixelised bitmaps. In
PS Level 2 and Level 3 the conversion of JPEG is inbuilt so the above
procedure just adds a bit of postscript header stuff to the unchanged jpeg
file. In other words this conversion is lossless.
You can also use "eps3" as the tag but beware that may be reasonably new
postscript printers that are not level 3 compliant. (Ghostscript is level 3
compliant).
____________________________________________________
Setting the Clock on Linux
Walt R ([89]wmreinemer from tns.net)
(!) [Jimmy] This is a follow-up to
[90]http://linuxgazette.net/109/lg_mail.html#mailbag.1
The following script is my interface to netdate. I modified the script found
at website listed in the script. You have to be root to set the system and
hardware clocks, yet you can query the time servers as a regular user.
Walt Reinemer
See attached [91]netdate.sh.txt
____________________________________________________
SMTP-time despamming
Ben Okopnik ([92]LG Editor)
Just saw this at [93]Freshmeat; sounds really sweet, particularly the
per-user configuration capability. Hopefully, the world is heading this
way...
...............
Mail Avenger 0.5.1
by xxx - Sun, Nov 21st 2004 02:48 PDT
About: Mail Avenger is a highly-configurable, MTA-independent SMTP server.
It allows you to reject spam during mail transactions, before spooling
messages in your local mail queue. You can specify site-wide default
policies for filtering mail, but individual users can also craft their own
policies by creating avenger scripts in their home directories. It includes
many features not supported by other SMTP servers, including mail-bomb
protection, integration with kernel firewalls, TCP SYN fingerprint and
network route recording, SMTP-level analysis of client implementations, SMTP
callbacks to verify sender addresses, per-user mail scripts that run during
SMTP transactions, virtual domain to user mapping for the purposes of
filtering, SPF (sender policy framework), dynamic SPF query construction in
mail filter scripts, support for easily issuing multiple concurrent,
asynchronous DNS and SPF queries from filter scripts, and the ability to run
spam filters such as spamassassin on message bodies before replying to SMTP
DATA commands.
Changes: A critical memory handling bug was fixed in the avenger.local and
deliver utilities.
...............
____________________________________________________
starting X automatically without [gkx]dm
Ben ([94]LG Editor)
As past discussions in TAG have shown, I'm definitely not a fan of the
various display managers; I believe that they take away, or obscure, too
much of the control that a user has over X. However, starting X
automatically from your ~/.bash_profile doesn't seem like a very smart move
either: any time you get a login shell (e.g., logging into another console),
you'd be firing off a new instance of X - or at least trying to, since it
would die with a list of error messages.
The answer to this dilemma is a conditional start for X - in other words, we
only want to execute it if it's not already running, i.e. only on the first
login. To do this, just add the following line to the end of your
~/.bash_profile:
=9= |