Oct 292014

Here are the basic commands to talk smtp to gmail.

We will send email from sender@gmail.com to recepient@gmail.com
The gmail password of sender@gmail.com is "my secret password".


To authenticate, we need our user/pass in base64 format:
base64("sender@gmail.com") = c2VuZGVyQGdtYWlsLmNvbQ0K
base64("my secret password") = bXkgc2VjcmV0IHBhc3N3b3Jk

To get the base64 encoded string, google "base64 online encoder" and click on any of the online encoder/decoders.

If you're using Gmail's two-step authentication

Go to https://security.google.com/settings/security/apppasswords and get a one-time password.

Ending the DATA of the email.

To end the DATA part, we need to press dot (".") and then Enter (which should send CRLF).

Important NOTE: I'm on a macbook, and the terminal client sends LF when I press enter. When I want to send CRLF, I press Ctrl+V, Enter. If you don't know what I'm talking about, after the dot (".") if it doesn't work with dot and Enter, press [dot, Ctrl+V, Enter].

The commands

We will use S_client which is like telnet, but supports SSL (encrypted telnet). You will need OpenSSL for that purpose.

[mihail@arch ~]# openssl s_client -connect smtp.gmail.com:587 -starttls smtp
[a lot of text will be printed - ssl info. For simplicity ignore it.]
auth login
334 VXNlcm5hbWU6
334 UGFzc3dvcmQ6
235 2.7.0 Accepted
250 mx.google.com at your service
mail from:<sender@gmail.com>
250 2.1.0 OK dc8smxxxxwib.7 - gsmtp
rcpt to:<recepient@gmail.com>
250 2.1.5 OK dc8smxxxxwib.7 - gsmtp
354 Go ahead dc8smxxxxwib.7 - gsmtp
subject:manual smtp with gmail
some text as the body of the email
more lines of text

250 2.0.0 OK 1414600919 dc8smxxxxwib.7 - gsmtp
221 2.0.0 closing connection dc8smxxxxwib.7 - gsmtp
[mihail@arch ~]#




If you want to use SSL 465, the command is:
#openssl s_client -connect smtp.gmail.com:465 -tls1

(here you need to start with HELO, and then AUTH LOGIN - I don't know why)


Also, some accounts fail with:

3073894076:error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshake failure:s3_pkt.c:598:

I don't know why. It seems like it wants to fall back to ssl3.

pixelstats trackingpixel
Oct 222014

I am selling my old motorcycle and it is listed on an online auctioning site. Following is my communication with a south-african guy trying to steal some money from me. I continued the communication with him as far as possible, because I was interested how these things go. My info is anonymised, his info is not, so that google may cache his name name and contact info. The fun part is in bold.

--- I receive a text from +1 (717) 826 0150:
Is ur bike for sales?if yes get back to me via email (dan.rowey147@hotmail.com)

--- I reply to the email:
My bike is for sale. You sent me a text. Wanna buy it?

--- him:
I am really interested in the immediate purchase of your merchandise and i will like to know how long have you owned it??  what's your best price for it and when last was it serviced?

--- me:
Now what?

--- him:
Thank you for getting back to me. Can you assure me that it's in good state and that i will not be disappointed with it.I'm ready to pay your asking price and to be honest, i wanted to buy this for my Son, but the issue is i am an oceanographer and i do have a contract to go for which starts tomorrow and am leaving any moment from now.The contract is strictly no call due to the lack of reception on the sea area. But I'm able to access email anytime as we will make use of laptop so my only quickest payment option is PayPal as i can send money via PayPal anytime.Since I'm requesting this transaction to be done via PayPal, i will be responsible for all the paypal charges on this transaction and if you don't have an account with paypal, its pretty easy, safe and secured to open one. Just log on to http://www.paypal.com. I hope we can make the purchase as fast as possible? I have a mover that will come for it once payment clears and they will take care of very necessary paper for me. So i look forward to hear from you soon. will like to see more pics.
I need the address where the agent will meet you and your PayPal Full name and email address so i can send the money now.

--- me: (newly created paypal account)
paypal account: xxxxxxxxx@gmail.com

--- him:
i have just completed the payment via PayPal. A total of €1,650.00 EUR was sent,€1,100.00 EUR for the bike and the extra €500.00 EUR for the shipping charges and €50.00 EUR for the western union charges am sure you notice that,which you will be sending the €500.00 EUR to the address below via western union.I will advice you to check your inbox or spam mail of junk am sure you will find the Paypal confirmation email in one of those box.

Name : D A V I D - O L A G U N J U
Address: 65 Celliers street,
City: Pretoria
Post Code: 0002
Country: South Africa.

The shipper would be coming around to your area to have the bike picked up once you have sent the shipping charges fee to them,as i need you to send me your home address for the pickup and let me know what time you want them to come for the pick up.

I will be waiting to hear from you once the money has been sent to the shipper.

--- him again:
i receive a message from paypal stating that a legal action will be take against you since you refuse play your role in the transaction going on between me and you and now i don't even know what to do because am confuse.So please lets try and sort this out try as much as possible to the money and settle the shipper because i wont like paypal taking a brutal action against you... Wish to read from you soon.

--- me:
Oh my god. What should i do to stop that? I have a lot of money in paypal and i don't want it blocked.

--- him:
Hi, it's up to you as well to act fast as I'd already made the full payment through PayPal. There is nothing I could do from my side to influence PayPal rules. It's better you act according to PayPal request or I mail PayPal to suspend the transaction.I look forward to hear from you soon...

--- me:
I already sent you the money. I am at work now and the receipt is at home. tomorrow I am going to scan it, because I don't have a scanner at home.

Please don't suspend the transaction.

--- him:
You can send the following details to me so that i can forward it to PayPal management..

(1) Sender's Name;
(2) Receiver's Name;
(3) MTCN (Money Transfer Control Number);
(4) Amount Sent;

Get back to me asap..

--- him:
Stephen De-Guerre
1650 EURO

You are ask to send the scan receipt to me,so that we can confirm the transaction.

--- me:
I can do that tomorrow evening.

--- him:
Send it now...........Cause FBI is on their way to your house.

--- me:

--- him:
Send it when you get home...

--- me:
PROMISE ME YOU WILL STOP THE FBI. I don't have a scanner at home. I can scan it at work only. Only if the scanner is free and nobody is in the office. I will wait after everyone leaves. So 5pm tomorrow

--- him:
I will ask PayPal management to stop the FBI....So get back to me with the scan receipt by 5pm tomorrow..

--- me:
Thank you, thank you, thank you, thank you. Why are you being so mean?

--- He stopped the communication ---

pixelstats trackingpixel
Aug 262014

Check System Information on TRIM support, should say No

sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original
sudo perl -pi -e 's|(^\x00{1,20})[^\x00]{9}(\x00{1,20}\x54)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
sudo touch /System/Library/Extensions/


Check System Information on TRIM support, should say Yes

Source: http://www.return1.at/trim-enabler-for-osx/

Update: my writes went from ~333mb/sec to 400-475 mb/sec on blackmagic disk speed test

pixelstats trackingpixel
Aug 162014

Това са ноти и таблатура за цялота песен.

Вариант 1: много подробно, всеки акорд е разложен отделно. За начинаещи.

pdf с ноти
pdf само таблатура.

pdf с нотиpdf само таблатура

Вариант 2: само акордите, един е разложен за пример, добавих и текста в пдф файла.


Screen Shot 2014-08-17 at 12.42.21 AM

Софтуер: TuxGuitar (free, java based, има го за Win, OSX, Linux). Ето и tx файловете, ако някой иска да редактира и/или поправя грешки.

Вървят ли двама, tuxguitar, таблатури и ноти


pixelstats trackingpixel
Aug 162014

TuxGuitar (free, java based) allows music composition (that's what I used it for). It is not very stable on OS X - it crashed several times on me and I had to rewrite what I had written :(

Easy to use. Copy/paste is achieved via Measures->copy/paste measure. It can export to pdf.
Screen Shot 2014-08-17 at 12.33.27 AM

pixelstats trackingpixel
Jun 202014

FYI: Eclipse Luna (4.4) is currently beta.

Create new Maven Project.

Open the pom.xml

Add the following dependencies:


The code is as follows:

package sty.qainjava.xpath.on.html;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.nio.charset.Charset;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.ContentType;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.htmlcleaner.CleanerProperties;
import org.htmlcleaner.DomSerializer;
import org.htmlcleaner.HtmlCleaner;
import org.htmlcleaner.SimpleHtmlSerializer;
import org.htmlcleaner.TagNode;
import org.w3c.dom.Document;
 * QAinJava: how to do an xpath on html in java.
 * We use <a href="http://htmlcleaner.sourceforge.net/">HtmlCleaner</a>
 * and <a href="https://hc.apache.org/">HttpClient</a>.
 * @author Mihail STY
public class Program {
	 * We're not using any methods so that the source code is as straight
	 * forward as possible.
	 * No exception handling at all for simplicity
	public static void main(String[] args) throws IOException,
	        ParserConfigurationException, XPathExpressionException,
	        TransformerException {
		String address = "https://www.google.com/";
		String html;
			// the httpclient part
			CloseableHttpClient httpclient = HttpClients.createDefault();
			HttpGet httpGet = new HttpGet(address);
			CloseableHttpResponse response = httpclient.execute(httpGet);
			HttpEntity entity = response.getEntity();
			ContentType contentType = ContentType.getOrDefault(entity);
			Charset charset = contentType.getCharset();
			BufferedReader r = new BufferedReader(new InputStreamReader(
			        entity.getContent(), charset));
			// we can directly plug the input to HtmlCleaner,
			// but we put it in a string so we can print it,
			// or save it to a file
			String line = null;
			StringBuilder builder = new StringBuilder();
			while ((line = r.readLine()) != null) {
			html = builder.toString();
		{// write html to a file
			BufferedWriter bf = new BufferedWriter(new OutputStreamWriter(
			        new FileOutputStream("google.html.xml")));
			// exception handling is not exceptionally good, but that's not our
			// focus here
		// HtmlCleaner part
		TagNode tagNode = new HtmlCleaner().clean(html);
		String cleanHtml = new SimpleHtmlSerializer(new CleanerProperties())
		// System.out.println(cleanHtml);
		{// write cleanHtml to a file
			BufferedWriter bf = new BufferedWriter(new OutputStreamWriter(
			        new FileOutputStream("clean.html.xml")));
			// exception handling is not exceptionally good, but that's not our
			// focus here
		// we need a DOM document to execute xpath, HtmlCleaner helps in creating one
		Document doc = new DomSerializer(new CleanerProperties())
		{// save dom to file with a transformer (just for testing purposes)
			TransformerFactory factory = TransformerFactory.newInstance();
			Transformer transformer = factory.newTransformer();
			transformer.transform(new DOMSource(doc), new StreamResult(
			        new File("dom.html.xml")));
		// the xpath part
		XPath xpath = XPathFactory.newInstance().newXPath();
		String imgURL = (String) xpath.evaluate("//img/@src", doc,
		//using two URLs we can make sure we get the absolute URL even if relative.
		System.out.println(new URL(new URL(address), imgURL).toString());
pixelstats trackingpixel
Jun 182014

There is a warning on the homepage of truecrypt


>WARNING: Using TrueCrypt is not secure as it may contain unfixed security issues

More info:



http://truecrypt.ch/ (forking or actually continuing the development)
https://ciphershed.org/ (truecrypt fork)

TrueCrypt's audit in pdf:

pixelstats trackingpixel
Jun 042014
  • Some people, when confronted with a problem, think, "I know, I'll use regular expressions." Now they have two problems.
  • Some people, when faced with a problem, think, "I know, I'll use #binary." Now they have 10 problems.
  • Some people, when confronted with a problem, think, "I know, I'll use #threads," and then two they hav erpoblesms.
  • Some people, when confronted with a problem, think "I know, I'll use #multithreading". Nothhw tpe yawrve o oblems.
  • Some people, when confronted with a problem, think, "I know, I'll use mutexes." Now they have
  • Some people, when confronted with a problem, think: "I know, I'll use caching." Now they have one problems.
  • Some people see a problem and think "I know, I'll use #Java!" Now they have a ProblemFactory.
  • Some programmers, when confronted with a problem, think "I know, I'll use floating point arithmetic." Now they have 1.999999999997 problems.
  • Some people, wanting an escape from their full-time job, think "I know, I'll contribute to open source." Now they have two full-time jobs.
  • Some people, when confronted with a problem, think: "I know, I'll think outside the box!" Now, they have 3.75 problems, an entirely new framework, and three dozen toll house cookies cooling in the kitchen.
  • Some people when confronted with a desire to use pithy quotes in their presentations think "I know, I'll use something from Star Wars". Now two problems they have.
  • Some people, when confronted with a problem, think, "I know, I'll use #UTF8." Now they à??????µ?ç°§ùÔ_¦Ñ?.
  • "I'll use #PHP!" Now they have ("1 apple" + "1 orange") problems.
  • "I'll use #Perl!" Now they have more than one way to have more than one problem....
  • Some people, when confronted with a problem, think, "I know, I'll use Shareware." Now they have two trials.
  • Some people, when confronted with a problem, think, "I know, I'll use delegations." Now their problem is a problem of their problem.
  • Some people when confronted with a problem think "I know, I'll quote jwz". Now everyone has a problem.

Source: http://nedbatchelder.com/blog/201204/two_problems.html

pixelstats trackingpixel