F/OSS and Donations
Hey All
So, making a few bucks in the F/OSS field.
I have not done it, heck I have not even tried it. All the code I write is out there for public use, with the exception of a few GPL stipulations.
I figure I’ll try the most non-invasive thing I can do — add a donate button to my website.
I’m going to let this roll for a month, and see what it does. My guess is there will be a exponential growth in returns from the run of the mill hacker to the high-profile F/OSS preacher.
Will follow up with my results :) Heck, if you feel like supporting my coffee addiction, hit that cup right below this post to donate :)
Filed under Life, the Universe and Everything, Tips and Tricks, Wisdom on Ubuntu | Comments (2)LGBT
Hey All.
So, some of you might be curious as to where I have been for the last week or so. I’ve been unusually absent from the usual day-to-day on Ubuntu work, so I figure that I’d put a post up to explain this a bit.
I am, as most of you know, a student at a Jesuit university in Ohio, John Carroll ( JCU ). There is currently a bit of noise about the LGBTQ ( Lesbian, Gay, Bisexual, Transsexual, Questioning ) community, and their rights.
The long and short of it is that the Administration of John Carroll decided on creating an “agreement” to dictate conduct, rather then a legally binding statement to protect the LGBTQ community. I have been involved with this a good deal, and it would mean a lot if you were to post your opinions here, or send an email to my University in support of creating a legally binding clause protecting LGBTQ members of the University. Any opinions you would like to share can be directed to the President of JCU, Father Niehoff, S.J.. Father Niehoff is supportive of this change, so if you are to send an email, please be respectful.
Thank you for taking the time to read this. Please consider helping us bring equity to Ohio, and John Carroll University.
*Edit*
Rbt Y-Lee was nice enough to share this link here. I figured someone else might find this as interesting as I did. Thanks Rbt!!
Filed under Life, the Universe and Everything, Tips and Tricks, Uncategorized, Wisdom on Ubuntu | Comments (7)Iterating using a for loop
Here is a neat tidbit I picked up, Iterating through a linked list with a for loop. I saw it as voodoo, but really neat. Let’s take a bit of a look.
Given the situation where linkeditem is a basic object with a forward pointer to the next item in the list, and an integer value, we can use a for loop to process the list with less code then the respective while loop.
Given the following setup:
linkeditem a(0);
linkeditem b(1);
linkeditem c(2);
linkeditem d(3);
linkeditem e(4);
and the given linked list pointers setup as follows:
a.forward = &b;
b.forward = &c;
c.forward = &d;
d.forward = &e;
and our function-level variables:
linkeditem * item = &a;
int current;
Here is how one would first think to iterate the list:
while ( item != NULL ) {
current = item->value;
item = item->getNext();
}
We can also loop through the items as follows, just by using a for loop. Why you ask? I ask why not.
for ( ; item != NULL; item = item->getNext() ) {
current = item->value;
}
It’s magic!
Filed under Tips and Tricks | Tags: c | Comment (0)Making a bootable USB drive
In this post, I will go over how to set up a USB disk in order to make it bootable. This is all pretty scary at first glance, but if you think before you do, and really examine what is going on here, it will be a bit more simple.
The only catch here is that the USB disk will come out as the same machine arch as the host box ( uname -m )
sdc should be replaced with the drive target of choice, this will be the correct drive if the USB key is the last drive plugged in, with two other internal drives, or one other flash drive. Please ( PLEASE ) check this before you begin, I don’t want to see anyone out there hose their Hard Drive!
First, we need to setup the device. Again, this is providing that sdc is your device.
This will wipe any data that is on the dive right now. First unmount the drive:
sudo umount `df | grep /dev/sdc | awk '{print $1}'`
If /dev/sdc is not mounted ( or any partition therein ) this will bomb with anger, but don’t worry. It won’t hurt your box. Best case is it runs without any output, and succeeds.
Then you will need to partition out the drive, use cfdisk to create a single partition on sdc, for use with the new live OS.
sudo cfdisk /dev/sdc
or, you can do it with fdisk if you are one of my more elite readers.
OK, so now that we have set up the partition table, it’s time to set up the device as ext3.
mkfs.ext3 /dev/sdc1
Great! So we have a usable flash drive again! ( Was it really that hard? )
OK, so now we need to mount the drive, and set the file system up.
Let’s first set up a folder to mount the flash drive. If you are like me and have one folder you always use ( and it’s not flash ) feel free to adjust this as necessary.
sudo mkdir /mnt/flash
OK, so now let’s actually mount the drive.
sudo mount /dev/sdc1 /mnt/flash
And a Kernel Interface ( proc ), along with the current Devices ( dev ).
Let’s create the correct folders, and mount filesystems.
sudo mkdir /mnt/flash/proc
sudo mkdir /mnt/flash/dev
sudo mount -t proc none /mnt/flash/proc
sudo mount -o bind /dev /mnt/flash/dev
OK, Awesome. Let’s check out some basic information about debootstrap. Debootstrap creates a basic debian install by downloading bleeding edge packages from the repo given. The basic syntax is debootstrap distro /place/to/point/
Debootstrap is not installed by default, so if you have not already done so, please install debootstrap. As we are using debootstrap, I figure you are on a debian system, so the natural command is
sudo apt-get install debootstrap
Debootstrap will create a fully chroot’able environment to use. Let’s get to it.
sudo debootstrap jaunty /mnt/flash/
Wahoo! Awesome. So we have a nice environment to use, lets move into it and set this guy up.
sudo chroot /mnt/flash
Let’s install GRUB. For some reason ( Please, someone comment about this, I would love a better way to do this ) files are not included. We will pull ‘em from the host box.
Well, let’s get to it.
sudo apt-get install grub
Then let’s exit the chroot, to copy in critical files.
exit
Let’s copy out the GRUB boot information / stage files.
sudo cp /boot/grub /mnt/flash/boot -r
Now that we have the boot files in the chroot, let’s go back and add finish the setup in the drive.
sudo chroot /mnt/flash
OK, first thing, lets set up the fabled device.map. This file scares small children, torments kids and frightens adults to tears when not setup right. This single file has accounted for more headache on my part then any other system config file. Let’s just set it up.
Vim is not installed by default, so if you would like to use vim, then install it with a simple apt-get. For the sake of simplicity, I will reference vi, but again, feel free to break from this guide and use vim.
vi /boot/grub/device.map
OK. Clear out this file, and insert this.
(hd0) /dev/sda
Or, if you are lazy, you can do this:
echo "(hd0) /dev/sda" > /boot/grub/device.map
So, now that we have the device map set up, let’s install the Linux image. This is, again, for Ubuntu Linux with a vanilla kernel. Feel free to change to the -rt kernel, PAE kernel, or roll your own, just deviate as necessary to make it work. If you get something cool working, feel free to email me, or throw a comment letting us all know!
apt-get install linux-image-generic
OK Let’s setup the menu.lst. First we need to remove whatever is in there. Remember, only do this in a chroot! Don’t hose your host box!
echo "" > /boot/grub/menu.lst
Let’s open up your menu configuration.
vi /boot/grub/menu.lst
This is an example entry that I used to boot, again, if your setup has been different feel free to change, and apply salt to flavor.
title Flash Drive
kernel /vmlinuz root=/dev/sda1 ro quiet
initrd /initrd.img
quiet
Awesome. We are almost there. Let’s get GRUB all setup on this device block.
grub
OK, Now that we are in the GRUB shell, let’s use it. I have pasted both the command, and the response. I will be sure to separate them.
grub> find /boot/grub/stage1
And, the resultant spew is:
find /boot/grub/stage1
(hd0,4)
(hd2,0)
OK, now we need to set root to our drive. hd2,0 is my drive, and usually it is safe to go with the highest number.
grub> root (hd2,0)
And our spew:
root (hd2,0)
Next, we need to setup the drive to ensure GRUB will work.
grub> setup (hd2)
And the spew:
setup (hd2)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd2)"... 16 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd2) (hd2)1+16 p (hd2,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.
Whoh, that was a lot. OK, well all is well, looks great. Let’s get outa here.
grub> quit
Let’s also get out of the chroot.
exit
Lastly, let’s unmount all of our devices.
sudo umount /mnt/flash/proc
sudo umount /mnt/flash/dev
sudo umount /mnt/flash/
There ya’ have it. A bootable flash drive, debian based, and all around nifty start. Remember, this is just a base, feel free to add on GNOME etc, make it your own
I’d like to thanks drs305 for reviewing this, catching a bunch of stuff I overlooked. Same goes to Bodsda, Thanks, guys!
Filed under Tips and Tricks, Wisdom on Ubuntu | Tags: boot, debian, flash, grub, usb key, Wisdom on Ubuntu | Comments (7)