Thursday, August 19, 2010

anonymous emailing for mailing lists that expose email addresses

#!/usr/bin/python

import smtplib
SERVER = "your.smtp.server"

FROM = "joe@example.com"
TO = ["mailinglist@exposes.emails.com"] # must be a list


SUBJECT = "my question to the gurus"
TEXT = """

How do I send a message to the mailing list without exposing my email address to 
spambots?

cheers,

j.


----
To hide my email address from spam-bots, this message was sent with a false sender address using Python's smtplib.

"""

# Prepare actual message

message = """\
From: %s
To: %s
Subject: %s

%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)

# Send the mail

server = smtplib.SMTP(SERVER)
server.sendmail(FROM, TO, message)
server.quit()


Wednesday, June 30, 2010

self_taught_programmers_need_these_things.txt

Design Patterns: common "Template" solutions to regularly encountered problems/variations-on-that problem. Be careful when learning these that you don't fall victim to "when you have a hammer, everything is a nail". Also learn the Anti-patterns, wikipedia has a good list of anti-patterns.

Algorithms & Data Structures: Analysis, average running time Big O is most important, but understanding worst-case runtime is important too. Designing algorithms vs knowing when to leverage an existing one.

the C++ standard library provides a great many of these, it has a high efficiency sort (from ), it has good collection data structures (vectors, linked lists, maps, etc)

Objected Oriented Analysis And Design: Knowing when to make something an object, when and how to use inheritance and polymorphism, when to not make something an object. Plain old data objects. separation of responsibility: UI is not logic, logic is not UI.

Threading: proper thread synchronization techniques (mutexs, semaphores, conditions, etc), threading patterns such as Producer-Consumer, Inter-process communication

Automata & Computability: (Deterministic|Nondeterministic) Finite State Machines, Regular Languages, Turing Machines

Programming Languages: LL language parsing & rules authoring.

Computer Architecture: Processor design, pipelining, caching, function calling conventions, etc - how to use this knowledge to write more efficient programs

DMG on Linux

Mounting Mac OSX dmg files on Linux

#sudo apt-get install dmg2img
# this outputs myfile.img
dmg2img myfile.dmg

#modprobe hfsplus
sudo mount -t hfsplus -o loop myfile.img $MOUNTDIR

Wednesday, May 12, 2010

Java in Python : JPype on Ubuntu Lucid

sudo apt-get install python-jpype openjdk-6-jdk
sudo update-java-alternatives -s java-6-openjdk

from jpype import *

startJVM("/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server/libjvm.so", "-ea")

java.lang.System.out.println("Hello World")

shutdownJVM()

KDE okular html links -> firefox

Use firefox instead of konqueror for html links in pdfs viewed in okular:

System settings -> Advanced -> File associations

Type in html in the search field and move firefox above konqueror for all html like content.

Have a lot of fun!

Friday, May 7, 2010

MySQL server on Ubuntu or debian

To setup a mysql server on my ubuntu 9.10 box, I followed this guide:

http://library.linode.com/databases/mysql/ubuntu-9.10-karmic

But connecting from another host gave me the following error:

$ mysql -u mysqluser -p --host=myhost.com

ERROR 2003 (HY000): Can't connect to MySQL server on 'myhost.com' (111)

http://dev.mysql.com/doc/refman/5.1/en/access-denied.html

The above link indicates this is a network error.

http://www.aboutdebian.com/database.htm

Referring to the above link, I found to enable access I needed to edit /etc/mysql/my.cnf, specifically, change the bind-address from 127.0.0.1:

#bind-address = 127.0.0.1
bind-address = myhost.com

and restart mysqld:

$ /etc/init.d/mysql restart


Other useful MySQL links:

Adding users, etc.

MYSQL Docs - Access Privilege System

MySQL and SSL

Thursday, April 29, 2010

delicious tips

URL to search for tags "search" and "android"

http://delicious.com/mydelcious_account/search+android