embedded gentoo [uclibc] | nothing beats this

A few uclibc embedded gentoo facts:

  • the compilation of the box takes around 15 minutes
  • at boot up, takes less than 3 megabytes of RAM
  • disk space: 17 megabytes
  • boots in under 8 seconds on a pentium3

link to stage3 tarballs archive
HTOP - Displaying System Statistics
# this is my make.conf, it should be the same in the stage3, if installing anything in the stage3, and even before updating, comment the line INSTALL_MASK=”*.h HACKING.gz TODO.gz”

CFLAGS="-Os -mtune=i386 -pipe"
CXXFLAGS="-Os -mtune=i386 -pipe"
CHOST="i386-gentoo-linux-uclibc"

FEATURES="strip"
MAKEOPTS="-j3"
GENTOO_MIRRORS="http://mirror.bytemark.co.uk/gentoo/ http://www.ibiblio.org/pub/Linux/distributions/gentoo"

USE="-ipv6 -python3 -cracklib -minimal"

LINGUAS="en"
VIDEO_CARDS=""
ACCEPT_KEYWORDS="~x86"
INSTALL_MASK="*.h HACKING.gz TODO.gz"

# download my stage3, from the previous post links, and then prepare to chroot

mount -o bind /dev stage3-*/dev
mount -o bind /proc stage3-*/proc
chroot stage3-*

# update the system, and create the necessary path, if you come across any errors, post them here, and expect a reply soon

emerge -avuDN world
mkdir /mounted

# begin the installation
# install necessary packages

ROOT=/mounted/ emerge -auvND baselayout uclibc bash dropbear pam udev iptables coreutils nano util-linux shadow kbd net-tools grep procps gzip sed findutils mawk htop
mkdir /mounted/proc
mkdir /mounted/dev

Continue reading “embedded gentoo [uclibc] | nothing beats this”

noCD? |boot from usb| Sabayon Linux

I had a pen-drive lying around, and so I decided to try out a new distribution of linux, Sabayon Linux.

Why Sabayon?

  • On a base install, everything is there and just works perfectly
  • For a newbie, the hard part is often getting playback codecs, well, Sabayon has them pre-installed
  • Sabayon has focused on the base theme too, it looks great
  • Entropy, their package manager, is really awesome, ‘man entropy’ to see more

Let’s mount and copy the contents of the live image, it can be downloaded here. As super user, do

mkdir /media/sabayon
mount -o loop /path/to/iso/file /media/sabayon

Plug in you pen-drive, wait for the device to settle down first, then copy whatever is important to you from the pen-drive to a hard-disk, and format it after you’ve successfully backed up your previous data

mkfs.ext3 /dev/sdyx

Replace sdyx as per your needs, i. e. the partition where you will be booting the live image from, in my case it was sdc1. You can choose any filesystem type you want to, but let’s just stick to ext3 for now.
Now copy the contents of the live image which you previously mounted to this drive after mounting it

mkdir /media/target
mount /dev/sdyx /media/target
cp -r /media/sabayon/* /media/target/

The parameter ‘-r’ indicates that it should copy recursively, and not just the files present in the top level directory
Now we’ll need to setup that device to boot correctly, you may not want to end up with a few errors and be done with it, do you?
Continue reading “noCD? |boot from usb| Sabayon Linux”

Restore Broken Package DB on Sabayon

System database not found or corrupted, running in safe mode using temporary, empty repository

phoenix jude # equo rescue resurrect
>> ####### ATTENTION: The installed package database will be resurrected, this will take a LOT of time.
>> ####### ATTENTION: Please use this function ONLY if you are using an Entropy-aware distribution.
     Can I continue ? [Yes/No] yes
     Are you REALLY sure ? [Yes/No] yes
     Do you even know what you're doing ? [Yes/No] yes
>>  @@ Creating backup of the previous database, if exists.
>>  @@ Previous database copied to file /var/lib/entropy/client/database/amd64/equo.db.backup.15103
>>   Initializing the new database at /var/lib/entropy/client/database/amd64/equo.db
>>   Database reinitialized correctly at /var/lib/entropy/client/database/amd64/equo.db
>>   Found 420663 files on the system. Assigning packages...
>>   Matching in repository: Sabayon Linux Official Repository
>>   Found 0 packages. Filling database...
>>   Database resurrected successfully.
>>   Now generating reverse dependencies metadata...
>>   Now indexing tables...
>>   Database reinitialized successfully.
>>   Keep in mind that virtual packages couldn't be matched. They don't own any files.
phoenix jude # 

fascinating and too simple!
For one thing, I have no clue why did it say “Found 0 packages.”, because just after this I was successful in doing an equo upgrade and it worked beautifully.
equo has become a teenager…

Easily Sort Your Music Library

Here is a very simple script to sort your whole music library according to their artists,

#!/bin/bash
# sortMusic v0.4
# make sure this script in in the music directory and you execute this script from there
# know issue: will display many errors, but it does it fine, those errors are not to be bothered about
# still needs a workaround
echo "$(ls -l *.mp3 | wc -l) Files will be sorted according to their Artists"
echo "Make sure all your song artists are correct, will wait for 3 seconds..."
sleep 3
for i in ./*; do
	artist=$(mp3info "$i" | sed -n 's/Artist: *//p')
	if [ -d "$artist" ]; then
		mv "$i" "$artist"
	else
		mkdir "$artist"
		mv "$i" "$artist"
	fi
done
# To move all the incorrect id3 artists
mkdir "Z Singles Z"
mv *.mp3 "Z Singles Z"

# That was very simple, wasn't it?

Just make a file called sortMusic-v0.4 in your main music folder, paste the above code into that file, then do $ chmod +x sortMusic-v0.4 and then do a $ ./sortMusic-v0.4 in the music folder. Please download mp3info as this uses that package. Please note that this is very case-sensitive, so if your artists are same but differ in case, it will make a new directory for that one, so please take care until I have a workaround for this.

NON-Standards Compliant C++ with Mumbai University

Mumbai University fails to keep up with the ever-evolving C++ syntax. Making Turbo C/C++ as their prescribed IDE, Turbo C/C++ is ancient and will not compile with the present syntax of C++. Here is the simplest example:

#include <iostream.h>
#include <conio.h>
void main()
{
	cout << "Hello";
}

The above code, when compiled with g++ 4.3.4, will give the following errors, but with Turbo C/C++ will compile and run just fine:

firstApp.cpp:1:22: error: iostream.h: No such file or directory
firstApp.cpp:2:19: error: conio.h: No such file or directory
firstApp.cpp:4: error: '::main' must return 'int'
firstApp.cpp: In function 'int main()':
firstApp.cpp:6: error: 'cout' was not declared in this scope

Here is the same code, but following the correct syntax:

#include <iostream>
using namespace std;
int main()
{
	cout << "Hello";
	return 42;
}

will compile and run just fine.

Argggg!!! This never ends! They even introspect on Valid XHTML and CSS standards!

[HOWTO] Create a hidden loopback device in a .jpg file

Well, I’m sure that you are definitely curious about how do you do this. Let me tell you this, it’s really simple.
Pre-requisites:

  • Image File(any format will do or even any file will do)
  • Linux(I’ve only tested it on this platform but I guess Mac would also do)

Let’s get started, shall we?
First create a standard loopback device.

dd if=/dev/zero of=hiddenimage bs=1M count=10

Let’s see what does this do:
It creates a file called “hiddenimage”, with it’s size as 10MB.
Then, create a filesystem on it.

mkfs.ext4 hiddenimage

mke2fs 1.41.8 (11-July-2009) hiddenimage is not a block special device. Proceed anyway? (y,n) y Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 2560 inodes, 10240 blocks 512 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=10485760 2 block groups 8192 blocks per group, 8192 fragments per group 1280 inodes per group Superblock backups stored on blocks: 8193 Writing inode tables: done Creating journal (1024 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 39 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.

Continue reading “[HOWTO] Create a hidden loopback device in a .jpg file”

[HOWTO] Dynamic Plugins for WordPress

Problem: Installed the hemingwayEx theme. Looks great, but the pagination doesn’t work well without the custom hemingwayEx pagination plugin. I got that installed. The hemmingwayEx theme looks cool when it displays two posts per page. The plugin worked well except that for my other two themes, displayed two posts per page. I posted a topic at WordPress Forums. No results.

Solution: Just at the beginning of the hemingwayEx theme, I modified it to create a cookie, like this:

<?php
if(!isset($_COOKIE["wptheme" . COOKIEHASH])) {
		$expire=time()+3600;
		$ctheme="hemingwayEx";
		setcookie("wptheme".COOKIEHASH, stripslashes($ctheme), $expire);
}
?>

Continue reading “[HOWTO] Dynamic Plugins for WordPress”

P&P Lava Lamp nav for your WP Blog

After two days of having intense jolts given to my head, I finally got the lava lamp navigation working! The orignal idea is from G. Marwaha’ Blog and Cory’s Place. By compiling the two articles, I have a clean way to implement it in probably any wordpress theme. I struggled at this one… but where there is a will, there is a way. This has been tested on the wordpress default theme and the subtleflux theme. You can see it live at my developmental theme. This is also for the lazy man, the quick “copy & paste” method.

So let’s get started, shall we?

Download this zip file containing the jQuery files for Lava Lamp Menu Unzip the files in your theme direcrory.

Continue reading “P&P Lava Lamp nav for your WP Blog”

Simple Steganography

Wanna hide that information and private things you don’t want your buddies to see? Here is what is called simple steganography. Steganography is the master of black arts. Nobody can ever suspect that there is a simple, easy-to-find drawer in one of your pictures. This works with .png files as I didn’t try it with any other. If the trick works on other file types, please let me know. All set to go? You need a GNU/Linux terminal or a Mac terminal to do this. Someone please post ways of doing this in Windows!
The Trick:
We have a file called “Secret Song.mp3”. We want to hide this into an image file. Let’s assume that our image file is called “Landscape.png”. First, compress the “Secret Song.mp3” into the .zip type compression. Then type the following in the shell:
Continue reading “Simple Steganography”