cache or die

volatile SoftReference<ConcurrentHashMap<Integer, Boolean>> cache;
Posted in programming | Tagged , , | Leave a comment

`while (true)’ all the way down; until the princesses…

 run() {
   while (true) {
     doRun();     // the princess is in another castle

 doRun() {
   while (true) {
     process();   // the princess is in another castle

 process() {
   while (true) {
     doProcess(); // the princess is in another castle

 doProcess() {
Posted in programming | Tagged , | Leave a comment


Install OpenSSH, ssh-agent, and Keychain.

# pacman -S openssh ssh-agent keychain

Edit SSH client configurations.

# nano /etc/ssh/ssh_config
  Protocol 2

  ControlMaster auto
  ControlPath ~/.ssh/socket-%r@%h:%p
  Compression yes
  AddressFamily inet

Edit SSH server configurations.

# nano /etc/ssh/sshd_config
  AllowUsers user@hostname
  PermitRootLogin no

  PasswordAuthentication no
  ChallengeResponseAuthentication no

Start the SSH daemon.

# systemctl start sshd
# systemctl enable sshd.service

Generate the SSH client key and export to the SSH server.

$ ssh-keygen -t ecdsa -b 521
$ ssh-copy-id -i ~/.ssh/ user@hostname

Optionally, add the SSH key to the keychain.

$ eval `keychain --eval --agents ssh -Q --quiet id_ecdsa`
Posted in Uncategorized | Tagged , | Leave a comment

Installing Cyanogenmod on the HTC Sensation

Rooting your Android phone can be a daunting task, considering the number of options, methods, and packages floating in the ethertubes. This guide attempts to provide a more detailed walk-through to installing Cyanogenmod on the HTC Sensation.


Begin by disabling Fastboot on your phone

Settings > Power > Fastboot

and enable USB debugging.

Settings > Applications > Development > USB debugging

Next, configure your Linux device subsystem to recognize your phone. The idVendor of 0bb4 is the HTC manufacturer ID returned by lsusb.

  # echo 'SUBSYSTEM="usb", ATTR{idVendor}=="0bb4", MODE="0666"' > /etc/udev/rules.d/51-android.rules
  # udevadm control --reload-rules


With the preparation complete, the first step is to gain S-OFF access with Revolutionary. S-OFF, or security off, access removes protected access from the bootloader and the root folders allowing you to write and install custom ROMs.

Download the latest revolutionary-X.X.tgz file, and unpack and execute the binary.

 $ tar xfz revolutionary-X.X.tgz
 $ ./revolutionary

Connect your phone to your computer, and restart the phone in Fastboot USB mode by first completely powering off, and then powering on with Volume-Down button depressed. If you do not see the HBOOT screen on startup, then try removing your battery for a few seconds before trying again.

HBOOT, the HTC bootloader, will initialize and drop you into a selection menu. Select Fastboot USB press the power button to enable Revolutionary to detect your phone.

Once Revolutionary recognizes your phone, it will provide you with your HBOOT version and serial number. Enter these numbers into the Revolutionary page to generate the beta key. Copy the key to the running program and Revolutionary will attempt to gain S-OFF access.

Once S-OFF access is granted, Revolutionary will prompt you to install ClockworkMod Recovery; press n to decline and install it manually.

ClockworkMod Recovery

ClockworkMod Recovery is a program that enables you to install custom ROMs to your phone. To install ClockworkMod Recovery, first download and install the Android SDK. Next, download the ClockworkMod Recovery ROM Manager, recovery-clockwork-X.X.X.X.img.

Run fastboot from the Android platform tools directory with the ClockworkMod Recovery image.

$ fastboot flash recovery recovery-clockwork-X.X.X.X.img

Android Superuser

With ClockworkMod Recovery installed, the next step is to use it to obtain root access with the Android Superuser custom ROM. Download the file and copy it to your SD card.

 # mount /dev/sdb1 /mnt/phone
 # cp /path/to/ /mnt/phone
 # umount /mnt/phone

Restart your phone into ClockworkMod Recovery mode by powering off and powering on with Volume Down depressed. Select RECOVERY, BACKUP AND RESTORE, and BACKUP to backup the original manufacturer’s ROM.

With the original ROM backed up, it is now safe to load Android Superuser. Select install zip from sdcard, choose zip from sdcard, and Once the installation is complete, select reboot and your phone will reboot with root access.


We are finally ready to install Cyanogenmod. Install Superuser and ClockworkMod ROM Manager from the Android Marketplace. Open the ROM Manager and select Flash ClockworkMod Recovery to update the application. The Superuser will prompt you to allow ClockworkMod Recovery root access; allow it. Finally, select Download ROM from the ROM Manager and install Cyanogenmod.

Posted in Uncategorized | Leave a comment

Irssi, BitlBee, and more…

Irssi is perhaps the best IRC client available, and BitlBee allows you to conduct your instant messaging and Twitter musings through the same IRC client.

First, install Irssi and BitlBee.

 # pacman -S irssi bitlbee

Once the installation is complete, start the BitlBee server and connect to it with Irssi.

 # /etc/rc.d/bitlbee start

 $ irssi -c localhost -p 6667

Within the Irssi client, create a BitlBee account, and add your Google account.

 [&bitlbee] register <bitlbee-password>

 [&bitlbee] account add jabber
 [&bitlbee] /oper <google-password>
 [&bitlbee] account on

To set up your Twitter account, follow the instructions below, and refer to

 [&bitlbee] account add twitter username password
 [&bitlbee] account on

If you are registered with Freenode, you can configure Irssi to automatically connect to the network and channels on startup.

 /network add -autosendcmd "/^msg nickserv ident pass;wait 2000" Freenode
 /server add -auto -network Freenode 6667
 /channel add -auto #irssi Freenode

If you do not have Freenode account, you can register from your Irssi client.

 /msg nickserv register <password> <email>
 /msg nickserv set hidemail on
 /nick <nick>_
 /msg nickserv identify <nick> <password>
 /msg nickserv group
Posted in Uncategorized | Leave a comment


Or Alice and Bob need an ansible.

The GNU Privacy Guard is an open source implementation of the OpenPGP
standard providing public-key encryption and digital signatures.

In order to utilize public-key encryption, it is required to generate
a keypair with which to sign and encrypt messages. A keypair consists
of a public key and private key; the sender will encrypt messages
using the receiver’s public key, which can then only be decrypted
using the receiver’s private key. For the highest level of security,
it is recommended to use 4096-bit RSA encryption at this time.

$ gpg --gen-key

To quickly generate entropy, start the following as root.

 # pacman -S rng-tools
 # rngd -r /dev/urandom

Upon creating the keypair, it is highly recommended to generate a
revocation certificate. The revocation certificate may be issued in
the event that the private key is compromised or the passphrase is
forgotten to notify senders that communication is longer valid or

$ gpg -o ~/.gnupg/revoke.asc --gen-revoke

In order to exchange secured messages, the sender must encrypt the
message with receiver’s public key. Public keys may be exported either
as binary (default) or ASCII-armored text using the –armor
option. The following command creates the public key file, alice.gpg,
that the sender requires to encrypt messages to Alice.

$ gpg -o ~/.gnupg/alice.gpg --armor --export

Importing public keys and assigning trust involves verifying and
signing the public key. Here, Alice imports Bob’s public key.

$ gpg --import bob.gpg

It is strongly recommended to verify the public key fingerprint with
the owner

 $ gpg --fingerprint
 $ gpg --keyserver --recv-key

before signing over trust.

 $ gpg --sign-key
 $ gpg --keyserver --send-key
 $ gpg --keyserver --recv-key


$ gpg --edit-key
  > fpr
  > sign

Finally, Alice can send and receive encrypted messages to and from

$ gpg -o MESSAGE.gpg -r --encrypt MESSAGE
$ gpg -o MESSAGE --decrypt MESSAGE.gpg

In addition to public-key encryption, GnuPG supports digital
signatures. Digital signatures combine the sender’s private key with
the message to certify that both the sender and the message have not
been tampered.

GnuPG provides three commands for creating digital signatures.

The –sign command makes a compressed, binary signature, and may be
encrypted with –encrypt.

$ gpg -o FILE.sig --sign [--encrypt] FILE

The –clearsign command makes a clear text signature.

$ gpg --clearsign FILE

The –detach-sign command makes a detached signature useful for
attachments and signing binary data.

$ gpg -o FILE.sig --detach-sign FILE

The sender’s public key is then used to verify digitally-signed

$ gpg --verify FILE.sig FILE
Posted in linux | Tagged , | Leave a comment

Mutt with Gmail

“All mail clients suck. This one just sucks less.”
   — Michael Elkins, Mutt creator

Mutt is a console-based email client, or mail user agent. It does
not send or retrieve emails. In order to send or retrieve emails,
one needs a mail transport agent, or MTA, and a mail retrieval
agent, or MRA. One popular configuration uses msmtp and

However, this entry will discuss using Gmail to send and retrieve
messages through the IMAP protocol. This keeps emails
synchronized across all running email clients.

Install mutt.

# pacman -S mutt

Create the mutt configuration file replacing NAME, EMAIL, and PASSWORD.

$ nano ~/.muttrc

# IMAP configuration

set realname="NAME"
set from="NAME "
set imap_user=EMAIL
#set imap_pass=PASSWORD
set folder=imaps://
set spoolfile=+INBOX
set record="+[Gmail]/Sent Mail"
set postponed=+[Gmail]/Drafts
set trash=+[Gmail]/Trash

set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/messages
set certificate_file=~/.mutt/certificates

mailboxes =INBOX

# SMTP Configuration

set smtp_url=smtps://EMAIL\
set ssl_force_tls=yes

set editor=nano

# Display

# color object foreground background
color status white blue
color index green default ~N
color index red default ~D
color index brightmagenta default ~T
color index brightyellow default ~F
color header green default "^Subject:"
color header yellow default "^Date:"
color header yellow default "^To:"
color header yellow default "^CC:"
color header yellow default "^Bcc:"
color header yellow default "^From:"
color header red default "^X-.*:"

Run mutt.

$ mutt
Posted in linux | Tagged | 4 Comments