Categories
Tutorials & Tips

Plain text markup languages

Instead of relying in complicated bloated office programs or embedding messy WYSIWYG interfaces in web applications, a quick way to format plain text is to use a markup language. Just like HTML that has tags to structure a document and render into special formatting, plain text can also be “pretty” by using a standard markup language. It is easier to type as they normally don’t interfere much in the visual aspect of the text. That means that even if you don’t have support for the markup language, you can read the text without problems.

On code documentation files, plain text markup languages are preferred over languages like HTML or LaTeX to waste little time on editing without loosing good presentation.

Some of these languages are:

Markdown

It was created as a plain text to HTML markup language made to simplify writing formatted text that will generally end translated to HTML tags. The syntax is very simple and supported on many text editors and web platforms.

Basic markup guide

# Heading 1
## Heading 2
*Bold*
– List item 1
– List item 2
+ sublist item
[text](Link)

Cheatsheet

You can find a markup cheatsheet here

You can read more on the markdown project website.

Asciidoc

As the website defines it, it is more than just a markup language. It is a text based document generation tool. You can create beautiful documentation with it by exporting to formats like HTML, PDF or LaTeX. Besides the usual markup of plain text, you can also use variables with a certain value to reuse across your document, saving you from typing repeated text or update a value in several places with one change.

Basic markup guide

== Heading 1
=== Heading 2
\*Bold\*
* List item 1
* List item 2
** sublist item
link_url[Link_text]

Cheatsheet

There’s an asciidoc cheatsheet here

You can read more at the asciidoc website.

Org

Org was born in the Emacs org-mode users world. I think besides Emacs there are no other places where org syntax is being used. Org lets you do many things in plain text, like organizing your to-do lists, your agenda, plan your projects, add source code blocks and execute the code right in your document among many other things. You can easily export to HTML, LaTeX, PDF among other formats. Some parts of the syntax can be complicated but since it is intended to be used within Emacs, it’s easy to handle with simple keyboard shortcuts.

Basic markup

* Heading 1
** Heading 2
\*Bold\*
/italic/
\_underline\_
- List item 1
- List item 2
  - Sublist item
[[Link_url][link_text]]

Cheatsheet

There are many Org-mode key stroke cheatsheets, but for markup only you can consult here

You can read more on the org-mode website.

Keyboard photo by Wouter Verhelst on Flickr
Categories
GNU/Linux Free Software & Open Source Tutorials & Tips

How to fix Skype on Debian 64bits constant crashing

debian logo skype logo

If you use Debian 64bits and Skype you may run into some trouble installing it and running it, since there is no 64bit version of Skype, setup is a little bit more complicated. The debian wiki explains how to install Skype on Debian and points to some troubleshooting, but not the one I was having.

Once I upgraded to Skype 4.0.2.11 on Debian 7, I started to have lots of crashes, to the point that I couldn’t use the application anymore.

After almost two months of frustrating constant Skype crashes, I finally found the missing piece. The error I was constantly getting was the following:

*** Error in `skype': corrupted double-linked list: 0xe2ee83e8 ***

To fix it, install libpulse0:i386

sudo apt-get install libpulse0:i386

Even though the Debian wiki indicates you should install it if you have audio problems, you must install it to avoid constant crashing.

Categories
GNU/Linux Free Software & Open Source Tutorials & Tips

Protect your personal information privacy with GPG encryption

Secure Cloud Computing

Political scandals have always been about leaked information. Don’t
you wonder why sensitive data has been passed around in clear text on
the leaked cables that Wikileaks has been making public, while your
latest SpongeBob Blu-ray or DVD disc is encrypted with DRM locks and
transactions like your book purchase at Amazon is secured and
encrypted by SSL certificates?

Encryption has been overlooked by general public all the time. You
only hear about it in “hacker” films or breaking news scandals. Although
encryption is commonly associated with hiding secrets, when in fact
it’s more about securing information. When you change the mindset
you’ll start considering encryption as something more relevant for
your everyday digital life.

For example, the cloud storage service Mega has encryption built in, after the
lessons learned on the data kidnapping of MegaUpload servers. This is
for the protection of both parties, the service providers and
yourself, the user. This way, only you can open the files and not even
Mega employees can know what is in your storage account. Dropbox,
Google Drive and other services don’t provide the same level of
security, so basically anyone that has access to those servers can see
your personal information.

There are many types of encryption methods. One of them is called GPG
(initially PGP but the free software version is known as GPG).

GPG is a two key system, where you hold a private key and a public
key. The way it works is that you encrypt a file with someone’s public
key and send it. On the receiving end, the other person has a private
key, and only with the private key the message can be deciphered.

Public keys can be obtained from the person directly through a file
transfer or email attachment prior to encrypted communication. Some
people, like me, publish their public keys on their personal web
page. The most common method to get a public key is to search it on
key servers. Most GPG GUI programs have the option to search, download
and upload public keys on key servers.

Encryption jargon

So to get started with protecting our data using encryption, you’ll
need to learn the basic concept words:

Encrypt

A blue lock for George

Encryption will protect the contents of the file, image, text or
whatever is being encrypted, so that only the owner of the private key
can view it.

If you want to protect a file only for your eyes, encrypt
it with your own public key.

Decrypt

Lock

This is the process of removing the encryption so that you can view
the contents of the protected file. This can only be done if the
contents were encrypted with the public key of the person who’s
supposed to see the information.

If someone sends you a file that was
encrypted with your public key, only you, who has the private key, can
decrypt the file.

Sign

Autograph

Sometimes the only layer of protection you need, is to make sure the
contents of a file or email were not altered between the time you send
it and the time it is received by the other person.

It also works as a way to make sure that a message is coming from you,
since you need your private key to sign the file and only you have
access to it.

Signing a file or text is a mechanism to know that the contents are
intact. This does not hide the message itself, it only adds a
signature to the file to ensure that every bit is in place with no
modifications.

Verify

Goodbye, Sammy. (With Flickr notes)

This is how you check a file or message’s signature for authenticity
and integrity. If the signature doesn’t match, it means that the file
has been altered or didn’t came from the right person.

You can sign or encrypt a message or file. Signing doesn’t hide the
information but it helps to certify that the information hasn’t been
modified by anyone else before reaching you. Encrypting will hide
the information so no one can see the message or file’s contents.

Setup

SSL

To setup GPG on your system, you’ll need to generate your public and
private keys. Any GNU based system is compatible with GPG (GNU Privacy
Guard). Most GNU/Linux distributions are already bundled with the gpg
command-line tool. If not, on a Debian-based distribution you can
install it with:

sudo aptitude install gpg

Generating your keys

Keys.

After you installed gpg on your system, to create your keys for the
first time, all you need to do is open a terminal and type:

gpg --gen-key

This will start a step by step process with some simple
questions. When in doubt, use the default options by just pressing
Enter. Don’t fear the command line, it’s just text.

When asked for a passphrase, note that GPG is not asking for a pass
*word*, it’s asking for a pass *phrase* so make sure it is longer than
one word and an easy to remember sentence.

Once that is done, you can check your list of keys with

gpg --list-keys

Key search and import

If someone hands you their public key on a file, you’ll need to import it to your keyring to use it:

gpg --import key.asc

The key.asc is the file with the public key.

You can also search for someone’s public key on key servers

gpg --search-keys [email protected]

After the results, the GPG will ask which key you want to
import. Select the key from the results list by their number at the
beginning.

Basic usage

Security

Encrypt

To encrypt a file, first you need to import the receiver’s public key,
then you can use it like this:

gpg --encrypt --recipient [email protected] my_message.txt

This will generate a file my_message.txt.gpg which is the encrypted
file you’ll want to send.

Decrpyt

To decrypt a file, the sender must have used your public key. You can
use whatever name you want for the output file, in this case
“my_message.txt”

gpg --output my_message.txt --decrypt my_message.txt.gpg

Sign

To sign a file you use this command:

gpg --armor --detach-sign myverifiedfile.zip

This will create an additional file called ‘myverifiedfile.zip.asc’
which is the signature to verify the file. Send both files to the
receiving end.

Verify

You receive two files: the data file and the signature file. You can
verify the signature with this command:

gpg --verify signature_file.asc myverifiedfile.zip

Frontend tools

If you’re on GNU/Linux and using KDE you can install the user interface KGPG

sudo aptitude install kgpg

On Gnome, you can use Seahorse

sudo aptitude install seahorse

For graphical user interface options on Mac OS X and Windows, you can
check the GPG website.

These GUI front ends will integrate well with your desktop
environments, so you can easily encrypt, decrypt, sign or verify files
from the file manger right-click menu options.

GPG and Email

The easiest way I can recommend to use encryption with email, is with
Enigmail, an extension for the Mozilla Thunderbird email client. It
integrates very well and makes it easy to sign, encrypt, verify and
decrypt email messages.

In case you haven’t generated any keys, Enigmail will help you
generate them with an easy step by step graphical Wizard.

locks

I hope this guide helps you know more about encryption and how to use it. And remember: Encryption is not only about hiding secrets; It’s about protecting your personal information.

Categories
Programming & Web Development Tutorials & Tips

Using Git with Subversion repository subdirectory

Git logo

Interacting a local git repository with a subversion one has been very useful and is very common on old projects. The way to do that is by using the git svn commands. But sometimes there are situations where there is one large repository with several projects as subfolders in that repo.

Using the standard svn cloning command:

git clone my_svn_repo_server.com/repository

Will checkout the whole SVN repository (all subfolders, hence, all projects) into your local machine. This can be very large if the codebase and history is big, and very slow to interact with, since getting your local repository updated will involve getting changes from all other projects.

To make git clone a subdirectory from an SVN repository, use the following:

git svn init http://my_svn_server.com/repository/path/to/directory/of/project
git svn fetch

This way you not only clone that subdirectory, but also you will get updates from only that folder, making faster code pulls and pushes to the central SVN repository.

While I consider a very bad practice to have one large Subversion repository with several projects inside it as subfolders, I’ve come across such setups several times and it drove me crazy to have to checkout the whole thing. Hope this helps out.

Categories
GNU/Linux Free Software & Open Source Tutorials & Tips

Upgrading Samsung Galaxy S from Telcel to Darky’s Rom v10.1 with Android Gingerbread

This upgrade took my whole Saturday so this post might save you a lot of time searching through forums to get the Darky ROM 10.1 on the Samsung Galaxy S. My phone came originally with a ripped off version of Samsung’s official 2.1 Eclair Android release, since Telcel, the main carrier in Mexico, removed all the google apps and replaced them with Yahoo! and Bing alternatives. So I’ve been using Darky Rom which is based on the 2.2.1 Froyo release. Now that Darky has recently released its 10.1 version, based on the 2.3 Android release, Gingerbread, I wanted to give it a try and do my upgrade.

So to install this version of Darky ROM, you need to have Ficeto’s JVH base ROM installed first. If you already have that, you can then follow the simple step by step guide. If not, like me, you’ll need to flash Ficeto’s JVH using Odin (MS Windows only) or Heimdall.

In the case of my phone, turns out that my carrier Telcel has modified the Sbl.bin file (secondary boot loader) and I cannot install this as easily since Odin will stop flashing at Sbl.bin and will not continue any progress. If this is your case, the way I solved it was using Darky’s ROM Resurrection edition. Flash it using Odin or Heimdall, then flash Ficeto’s JVH base ROM, finally follow the step by step guide to install Darky’s ROM 10.1 using ClockworkMod’s Rom Manager or the Darky ROM Configurator app.

Another tip: Even the guide says you don’t need to wipe the cache or data, I always find it better to do so. When I don’t, I get either lots of apps crashing upon booting the phone, or I can’t make any calls; they get cut off (hang up) before I get the first ring. So backup your apps and data with apps like Titanum Backup and do a wipe of both data and cache. Also remember to do wipe battery stats and flash the new rom with a full charge for better battery life.

Categories
Emacs GNU/Linux Free Software & Open Source Tutorials & Tips

Change your default browser to Chromium in Debian and Emacs

Chromium Logo

The web browser is nowadays the most important and frequently used tool in a computer. Recently I’ve been using more the Chromium browser than Firefox, on in Debian’s case, Iceweasel. This is for several reasons:

– Better memory management (doesn’t eat up all my RAM)
– Extensions are also available for Chromium
– Faster browser startup
– Faster page loads
– Full HTML5 support, which is lacking in Debian Wheezy’s Firefox (err… Iceweasel) which is still on version 3.5.19 at the time of this writing.

So I decided to change my default browser to open in Chromium for all applications. To do the change, at the terminal, type:

sudo update-alternatives --set x-www-browser /usr/bin/chromium

and

sudo update-alternatives --set www-browser /usr/bin/chromium

If you’re using KDE 4 you also need to open the System Settings, click on Default Applications, Select Web Browser and choose the second radio button option so it reads: “Open http and https URLs in the following browser” and type “chromium” in the text box. Click the Apply button and close the window.

Since I do almost everything with Emacs, I also needed to configure it to use Chromium as its default browser. To set that, you just need to add the following to your .emacs file:

(setq browse-url-browser-function 'browse-url-generic
      browse-url-generic-program "chromium-browser")

I still love Firefox, but it has staled away from the cool minimalistic and fast browser it was when it started. Chromium is now filling that gap, so I hope that in future versions (maybe the new Firefox 5?) memory handling gets better as well as loading times.