Fixing my broken monitorTwo month ago my old monitor, a Samsung SyncMaster 930BF broke. It is quite old, but I really got used to work with two monitors. At first it took some time before the monitor displayed something after turning it on, or it switched between modes and the green power LED blinked rapidly. After some more days the display stayed black. Id did some research on the internet and found an article describing my problem. If it was true, I may be able to fix that. Today I decided to loosen the screws of the old monitor an look for a bloated capacitor1). A story of successAs the headline assumes, I've been successful! But I've docuemented some of my actions using photos and those I won't keep back. Looking a the first picture, you'll see the bloated capacitor, after locating the pins on the back, I had to remove it. I've used my soldering iron a used a temperatur around 400°C. The solder on factory soldered circuits can be really tough. To “absorb” the solder I am using a vaccuum pump. Luckily I had some replacement for the the old capacitor. They used a 1000µF-16v capacitor and so I started to re-solder the replacement. In the final step I cut the legs of the newly installed capacitor and reassembled the monitor, to test it. I had to re-open it three times, before I got some results, because I've forgotten to reconnect all cables! So check twice, if everything is properly connected and in place. The last picture shows the result of my work! The display is working again and turned on without any delay!
A word of cautionHere is a warning to everyone who wants to try this, too. You are working with “high voltages”2). Capacitors can hold voltages over a long duration! UPDATE #1: You should discharge the capacitor before measure it, otherwise it could harm your multimeter and/or your health! You can read the following article about capacitors, to be sure you won't do anything wrong: http://www.repairfaq.org/sam/captest.htm Also there is now guarantee, that this is working for your broken monitor. It also voids the warranty of your device! I only tried to fix it my self, because the monitor is far beyond any warranty claim! You have been warned, I am not responsible for your mistakes! 2)
for a computer scientist they are fairly high
Quick solution for SPAM reports on your mailserverRecently I have been faced with the problem, that I haven't read all mails send to me. My sieve-rules are set to mark all SPAM as read if the score is above a certain X-Spam-Score level. It is a practial solution to get them out of your sight, and keep the new mail notifications of my mail reader low. I don't go through every SPAM mail I receive, so it happened that I've missed a view mails really ment for me. One solution, which I've implemented, is to parse all mail located in the SPAM folders and generate a report and send it as mail every 24h. The following scripts are ment to be used on mailboxes using maildir format. Please note, both scripts are quick-hacks and not optimized. If you have any recommandation for improvements, do not hesitate to leave a comment or send me an email. Spam gathering
#!/usr/bin/env python import email import shelve import datetime import sys import os.path VERSION = '0.0.2' CHECKDIR = ['cur', 'new', 'tmp'] count_spam = 0 def scan_maildir(arg, dirname, names): global count_spam if dirname[len(dirname)-3:] in CHECKDIR and dirname.find('.Junk') >= 0: for file in names: filename = os.path.join(dirname, file) fp = open(filename, 'r') if fp: msg = email.message_from_file(fp) fp.close() #for k in msg.keys(): # print '>>>', k, msg.get(k) id = msg.get('Message-id') if id not in db_junk.keys(): db_junk[id] = {'Date': msg.get('Date'), 'From': msg.get('From'), 'To': msg.get('To'), 'Subject': msg.get('Subject'), 'Score': msg.get('X-Spam-Score'), 'filename': filename, 'lastseen': str(datetime.date.today()), 'reported': False} count_spam += 1 if len(sys.argv) > 1: maildir = sys.argv[1] db = shelve.open(os.path.join(maildir, 'junkmail.db'), 'c') try: if db['version'] != VERSION: print 'Database version missmatch!' print ' Database:', db['version'] print ' Script :', VERSION print 'Aborted.' sys.exit(2) except KeyError: #print 'Initializing database version', VERSION db['version'] = VERSION try: db_junk = db['junk'] except KeyError: db['junk'] = {} db_junk = db['junk'] os.path.walk(maildir, scan_maildir, None) db['junk'] = db_junk # write changes to shelve else: print 'Not enough parameters. Specify path to scan.' sys.exit(1) db.close()
# Example script invocation: $ ./spamsum.py ~/Maildir The script above only takes the directory to parse as parameter. This directory is used as root where it stores all information about SPAM in a file called junkmail.db. I haven't implemented anything to purge the database, if mails are deleted. Report generation
#!/usr/bin/env python import shelve import datetime import sys import os.path import smtplib from email.mime.text import MIMEText VERSION = '0.0.2' SENDERMAIL = 'spamreport@localhost' if len(sys.argv) < 3: print 'Not enough parameters. Specify path to scan.' print 'Usage:\n\t%s <maildir> <email>' % sys.argv[0] sys.exit(1) maildir = sys.argv[1] email = sys.argv[2] db = shelve.open(os.path.join(maildir, 'junkmail.db'), 'w') try: if db['version'] != VERSION: print 'Database version missmatch!' print ' Database:', db['version'] print ' Script :', VERSION print 'Aborted.' sys.exit(2) except: print 'Database is empty.' sys.exit(3) try: db_junk = db['junk'] except: print 'Database is empty.' sys.exit(3) sep_line = '=' * 78 spam_count = 0 line = 'Summary of unreported SPAM mails:\n%s' % sep_line senders = [] text = [line] for id in db_junk: if not db_junk[id]['reported']: junk = db_junk[id] #print id, db_junk[id] line = ' [ ] From: %s --> To: %s\n\ Subject: %s\n\ Date: %s\n\ Spam-Score: %s\n' % (junk['From'], junk['To'], junk['Subject'], junk['Date'], junk['Score']) text.append(line) senders.append((junk['From'], junk['Date'], junk['Score'])) junk['reported'] = True spam_count += 1 db['junk'] = db_junk # sync changes db.close() text.append('\n\n') text.append('Summary of unreported SPAM sender addresses:\n%s' % sep_line) for sender in senders: line = ' [ ] From: %s\n\ Date: %s\n\ Score: %s\n' % (sender[0], sender[1], sender[2]) text.append(line) msg = MIMEText('\n'.join(text)) msg['Subject'] = '%d reported Mails by GoatPr0n SPAM Report' % spam_count msg['From'] = SENDERMAIL msg['To'] = email if spam_count > 0: s = smtplib.SMTP('localhost:10025') # bypass spamassassin s.sendmail(SENDERMAIL, [email], msg.as_string()) s.quit()
# Example script invocation: $ ./spamreport.py ~/Maildir admin@localhost This script needs to be run with two parameters. The first one is the root directory where junkmail.db is located and the second one is the email address the genereted report is sent to. Cron job
#!/bin/sh set -e PATH=/usr/bin:/usr/local/sbin MAILDIRS=/path/to/maildirs for maildirs in $MAILDIRS/*; do for maildir in $maildirs/*; do email=`basename $maildir` spamsum.py $maildir spamreport.py $maildir $email done done I have placed it in /etc/cron.daily. The resulting report
Return-Transfer-Encoding: 7bit
Subject: 1 reported Mails by GoatPr0n SPAM Report
From: spamreport@localhost
To: admin@localhost
Summary of unreported SPAM mails:
==============================================================================
[ ] From: "Drugstore #1" <root@localhost> --> To: admin@localhost
Subject: *****SPAM***** Welcome, admin. Everything on -80% today
Date: Tue, 23 Mar 2010 21:56:44 -0500
Spam-Score: 10.5
Summary of unreported SPAM sender addresses:
==============================================================================
[ ] From: "Drugstore #1" <root@localhost>
Date: Tue, 23 Mar 2010 21:56:44 -0500
Score: 10.5
The email addresses in these samples have been altered, so hopefully email crawlers use them to send the spam to their selfs… Wallpaper management pt.1
I really like wallpapers (especially those with babes $ find wallpapers_skins.be -type f | wc -l 35640 This is the result after running it to fetch all images with a resolution of 1920×1200 and 1280×1024 and I also downloaded other websites… Okay, let's just say I've got a lot of wallpapers. The problem you'll face is, which wallpaper you should use. My window manager is Xfce4 and it supports image-lists to pick a random background image on login. To pick a random wallpaper during your session you can force Xfce4 to switch to a none-wallpaper and immediately back to you image-list. I wrote a little tool, placing it self in your system tray, to do it. An old description of the project can be found here, but I recently rewrote the whole application but I haven't had time to write the project page for it. The behavior is pretty much the same but the code is much more organized. To download the project you can go to http://git.goatpr0n.de/Xfwpc/ and download it from there. Xfwpc has some features which you might find interesting:
After advertising my Xfwpc project a little bit, I'll come to the main reason why I started writing this blog entry - I always start without plan. Just typing and typing and typing, blah blah blah, errr back to the text. In order to manage the flood of wallpapers I've collected, I wrote scripts to automaticly add the images to the correct image-list of a monitor based on its resolution ratio. Today I've wrote a script to use from within feh. feh is a very cool image viewer with some nice features. What I did, was to define two actions to add a wallpaper to monitor 1 or 2. So let's have a look at the script first. #!/usr/bin/env python import sys, os import gtk, pynotify import Image import subprocess screen = gtk.gdk.Screen() def add_to_list(image, monitor): cmd = 'xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor%s/last-image-list' % monitor pipe = subprocess.Popen(cmd, shell=True, bufsize=128, stdout=subprocess.PIPE).stdout listpath = pipe.readline().rstrip('\n') print listpath fd_list = open(listpath, 'a') if fd_list: fd_list.write(os.path.expanduser(image) + '\n') fd_list.close() n = pynotify.Notification('Wallpaper added.', 'Successfully added %s.' % image, 'dialog-ok') n.set_urgency(pynotify.URGENCY_NORMAL) n.set_timeout(3000) n.show() def get_ImageRatio(image): try: img = Image.open(image) except: n = pynotify.Notification('Image error', 'Failed to load %s' % image, 'dialog-no') n.set_urgency(pynotify.URGENCY_CRITICAL) n.set_timeout(3000) n.show() raise Exception('Image error') w, h = img.size del img return 1.0 * w / h def get_MonitorRatio(monitor): geometry = screen.get_monitor_geometry(int(monitor)) ratio = 1.0 * geometry.width / geometry.height return ratio def main(argv): pynotify.init('Wallpaper adder') if len(argv) < 3: print 'Not enough parameter. Need monitor name and at least one image.' sys.exit(1) monitor = argv[1] images = argv[2:] for image in images: iRatio = get_ImageRatio(image) mRatio = get_MonitorRatio(monitor) if iRatio == mRatio: add_to_list(image, monitor) else: n = pynotify.Notification('Wallpaper resolution error', 'Skipping %s. Wrong ratio: %4.3f:%4.3f' % (image, iRatio, mRatio), 'dialog-no') n.set_urgency(pynotify.URGENCY_CRITICAL) n.set_timeout(3000) n.show() if __name__ == '__main__': main(sys.argv) The script checks if the image fits the screen ratio of the current resolution and then adds it to the image-list of the given screen. The path to the list is determained by invoking xfconf-query. To use the script with feh, I have added the following alias to my shell configuration alias feh="feh --action1 '${HOME}/bin/wallpaper_add2Monitor 0 \"%f\"' --action2 '${HOME}/bin/wallpaper_add2Monitor 1 \"%f\"'"
If I run feh and press 1 or 2. We will run the script to add it to the image-list.
I haven't re-read this entry (tl;dr), but I hope you've got what I
was trying to say and give some feedback, but not on the crappy writing style paganfest 2009I have just returned from Paganfest in Frankfurt Batschkapp. Wow, what a great event. Okay, I am a bit early home again, but beeing there since 5 pm and banging and moshing the whole time can be really exhausting. The first band was Swashbuckle, they dress like pirates and play death-metal. I liked his fluffy toy parrot on the shoulder of the lead singer. The next band was Ex Deo. It was the first time I've listened to their music. They are playing great death-metal. They take the inspiration for their lyrics from the old rome. But one absolute party overkill act has been Alestorm. They play absolute f*cking genius pirate-metal1). Just everyone was banging and singing to their songs! Absolutly a must-have in every metal collection.2) The fourth band was Unleashed, but I took a little timeout, so I haven't seen the whole act. They were okay. Not really one of my favorites, but quite okay. The next ultimate act on this evening was Die Apokalyptischen Reiter, I've never saw them live before, despite the fact that they are one of my favorite bands. It was fantastic. There was a wall-of-death, I almost lost my shoe during that. Alestorm tried to make a wall-of-death, too, but I think there where to many little kids, which cannot count to three and wait for the “Go!”. So their wall-of-death perished within a simple “Pogo-session”. Back to the Reiter. It was just brilliant, how the lead singer transfered his energy and enthusiasm to the masses at the moshpit. Brilliant! The last one this evening were Korpiklaani, which is also nice music to party. The first thing which attracts attention is the bottle of Vodka he trinks during the gig. Okay, I call it for the day. I am tired. Good bye! Blogging with DokuVimKiIf you love Dokuwiki and Vim you also propably know DokuVimKi, but do you use it for blogging? I do, sometime at least, but what me really bugged, was that there is no template, like the web frontend provides. But Vim wouldn't be Vim, if it couldn't be fixed. So here is my solution. To get it working the way I use DokuVimKi you just need to follow the following steps: How to installThe shell aliasPut this function into your shell configuration (.zshrc, .bashrc)
function viDokuVimKiBlog() { if [ $# -lt 1 ]; then echo "You should give your blog article a title!" return fi TITLE="$*" DW_PATH=blog:`date +%Y:%m:%d`.`echo ${TITLE} | sed 's# #.#g'` vim +DokuVimKi +"DWNew ${DW_PATH}" +"silent! 0r ~/.vim/templates/blog.dokuwiki.tpl" \ +"%s/%TITLE%/${TITLE}/g" } alias viblog='viDokuVimKiBlog' The templateCreate a template diretory: % mkdir ~/.vim/templates Create you template called blog.dokuwiki.tpl: % cat << EOF > ~/.vim/templates/blog.dokuwiki.tpl ====== %TITLE% ====== ~~NOTOC~~ EOF How to useThe next time you want to blog you can start the whole environment with
% viblog This is a new entry to my blog
This will start vim and create a new page in the namespace defined by the DW_PATH variable in your shell configuration. You may need to modify it. I use the following namespace to blog: blog:%year%:%month%:%day%.%title_of_entry% UpdatesUpdate #1: I've fixed the viDokuVimKiBlog() function. Within the if-fi-statement was an exit, which causes your shell/terminal to logout/close. The correct function is a simple return. Update #2: Fixed some stupid typos. |