A bit of programmer fun, to brighten your day: http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered/
Disorganised Collection of Random Stuff
Don't forget to flush your buffers!
Search This Blog
Monday, June 3, 2013
Tuesday, March 19, 2013
Things overheard from Klingon programmers
- Defensive programming? Never! Klingon programs are always on the offense. Yes, offensive programming is what we do best.
- Specifications are for the weak and timid!
- This machine is GAGH! I need dual Pentium processors if I am to do battle with this code!
- You cannot really appreciate Dilbert unless you've read it in the original Klingon.
- Indentation?! I will show you how to indent when I indent your skull!
- What is this talk of 'release'? Klingons do not make software 'releases'. Our software 'escapes' leaving a bloody trail of designers and quality assurance people in its wake.
- Klingon function calls do not have 'parameters' - they have 'arguments' -- and they ALWAYS WIN THEM.
- Debugging? Klingons do not debug. Our software does not coddle the weak. Bugs are good for building character in the user.
- I have challenged the entire ISO-9000 quality assurance team to a Bat-Leth contest on the holodeck. They will not concern us again.
- A TRUE Klingon Warrior does not comment his code!
- By filing this bug report you have challenged the honor of my family. Prepare to die!
- You question the worthiness of my code? I should kill you where you stand!
- Our users will know fear and cower before our software! Ship it! Ship it and let them flee like the dogs they are!
- Our competitors are without honor!
- Java? That is for children. A Klingon Warrior uses only machine code, keyed in on the front panel switches in raw binary.
- Klingon programs don't do accountancy. For that, you need a Ferengi.
- Klingon multitasking systems do not support "time-sharing". When a Klingon program wants to run, it challenges the scheduler in hand-to-hand combat and owns the machine.
- Perhaps it IS a good day to die! I say we ship it!
- My program has just dumped Stova Core!
- Behold, the keyboard of Kalis! The greatest Klingon code warrior that ever lived!
Wednesday, May 2, 2012
No sound/audio in Wine (1.4, 1.5, newer)
When upgrading to a recent version of WINE (>= 1.4), you may end up without sound. winecfg has "Selected driver: (none)" in the Audio tab. Before running around, recompiling umptheenth time various wine versions and checking dependencies (like I did), first verify its registry. As noted in http://wiki.winehq.org/Sound there may be an invalid or empty entry in [HKEY_CURRENT_USER\Software\Wine\Drivers]. Run regedit, delete the Audio entry from that key, run winecfg again and it might just work.
There are other possible causes for this problem, but if sound works in other apps, check this first.
Civilization IV works great! with WINE 1.5.3. Railroads! works too, but performance is poorer.
Wednesday, April 11, 2012
Force IPv4 precendence over IPv6
Since a couple of days ago, apt-get tries to contact some of the hosts from my /etc/apt/sources.list via IPv6 and fails. To force it to prefer IPv4 over IPv6, add in /etc/gai.conf:
precedence ::ffff:0:0/96 100
This can be forced globally by adding to /etc/sysctl.conf, then reloading settings with sysctl -p
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.all.forwarding = 0
Wednesday, March 14, 2012
GMail + Mutt + IMAP + msmtp tiny HOWTO
This does not work anymore. Instead see a much better and more secure guide at https://gist.github.com/bnagy/8914f712f689cc01c267
This information was compiled from my own experience and from various webpages. Search for mutt gmail and you'll find plenty of references, but some of them are outdated. What I've written below works. I will keep it up-to-date as long as I keep using gmail with mutt.
Don't copypaste blindly. Check paths and other settings both in commands and in config files. I used ~/gmail.crt as certificate path, username@gmail.com as the login/from address, yourpassword as password, /home/myusername as home directory.
1. Get msmtp with OpenSSL support. Get mutt with IMAP support. For Debian I prefer mutt-patched.
2. Get SSL certificate for google:
wget -O ~/gmail.crt http://www.geotrust.com/resources/extended-validation-ssl/certs/Equifax%20Secure%20Certificate%20Authority.crt
3. Verify msmtp will work with this certificate. If this doesn't work, you won't be able to send email.
msmtp -S --host=smtp.gmail.com --tls=on --tls-trust-file=~/gmail.crt --tls-starttls=on --tls-force-sslv3=on --port=587
You should see something like:
SMTP server at smtp.gmail.com (fx-in-f109.1e100.net [74.125.39.109]), port 587: mx.google.com ESMTP o23sm81058faa.9 TLS certificate information: Owner: Common Name: smtp.gmail.com Organization: Google Inc Locality: Mountain View State or Province: California Country: US Issuer: Common Name: Google Internet Authority Organization: Google Inc Country: US Validity: Activation time: Wed Feb 16 06:38:09 2011 Expiration time: Thu Feb 16 06:48:09 2012 Fingerprints: SHA1: DB:A0:2A:07:00:F9:E3:23:7D:07:E7:52:3C:95:9D:E6:7E:12:54:3F MD5: 02:4C:12:F3:37:1F:0C:C1:EB:10:4B:92:F7:F1:E0:DF Capabilities: SIZE 35882577: Maximum message size is 35882577 bytes = 34.22 MiB STARTTLS: Support for TLS encryption via the STARTTLS command AUTH: Supported authentication methods: PLAIN LOGIN
4. Edit your .msmtprc
------xxx------ account gmail host smtp.gmail.com from username@gmail.com auth on tls on tls_starttls on tls_force_sslv3 on tls_trust_file /home/myusername/gmail.crt user username@gmail.com password yourpassword port 587 syslog off logfile /home/myusername/.msmtplog account default: gmail ------xxx------
then
chmod 600 ~/.msmtprc touch ~/.msmtplog && chmod 600 ~/.msmtplog
5. Edit your .muttrc. It should contain at least:
------xxx------ set imap_user="username@gmail.com" set imap_pass="yourpassword" set sendmail="/usr/bin/msmtp" set from="username@gmail.com" set realname="Your Real Name" set use_from="yes" set folder="imaps://imap.gmail.com:993" set ssl_force_tls="yes" set spoolfile="+INBOX" set postponed="+[Gmail]/Drafts" set record="/dev/null" set imap_check_subscribed set timeout="90" set imap_keepalive="300" set mail_check="150" set header_cache=~/.mutt/cache/headers set message_cachedir=~/.mutt/cache/bodies set certificate_file=~/.mutt/certificates ------xxx------
6. Everything should work. If not, check paths, usernames, passwords and search on Google for whatever errors msmtp or mutt throw.