Scripts

- 06-28-2009 5:50 pm

I've been lazy for a lil while, but I've gotten some motivation and setup a git repo for my scripts. Some of them I use on a day to day basis, and others I'll use once a year ;) I've added a couple so far, and will add more soon...

Check out the Scripts link to the top right of the page.

Enjoy, Fsk141

Featured on Arch Linux Newsletter :)

- 05-11-2009 2:38 am

Well this was unexpected, and quite entertaining... I ended up in the comedy section of the Newsletter:http://www.archlinux.org/static/newsletters/newsletter-2009-may.html

Anywho, I got a kick out of it, and just thought I should share.

louipc> tiddly eh?
fsk141> ya
fsk141> it seems like the best solution
fsk141> I compiled zim for os x, but it's a piece of crap
louipc> the website almost made me crap myself
fsk141> what site?
fsk141> tiddlywiki?
fsk141> good or bad way?
louipc> crapping pants is always bad isn't it?
fsk141> hehe
louipc> unless you're into that kind of thing haha

Tiddlywiki Syntax Highlighter

- 04-14-2009 10:40 am

Ohhh! Awww!sh
The tiddlywiki implementation of syntaxhighlighter is crucial part of my note taking experience. I do a lot of note taking pertaining to code, and this makes it nice and pretty. I had some trouble finding the correct link to the plugin. The link on tiddlywiki.org/wiki/Syntax_Highlighting was broken, and since it was in japanese, I had difficulty searching the site for the section I needed. Anywho I stumbled across the correct link and fixed it in the tiddlywiki post on syntax highlighting. Well then why am I making this post? Well first off to give a little better install instruction, and a link to the plugin for easy of use ++ link back to original site.

How to install
----------------

Simple Way:

Navigate to your TiddlyWiki & click the backstage link at the upper right, followed by the import button. Paste the URL of my Notes into the URL box: "http://dl.getdropbox.com/u/52078/Notes/Notes.html" followed by the open button.

You will be presented with a long list of tiddlers. You can proceed to scroll down to the bottom and check 'StyleSheet', 'StyleSheetSyntaxHighlighter' and 'SyntaxHighlighterPlugin' followed by the import button.

That should be it, enjoy.

Manual Way:

Download 'syntaxhighlighterplugin.zip' from:

http://www.coolcode.cn/?action=show&id=310 (look for the link near the top of the page)

or my mirror:

http://dl.getdropbox.com/u/52078/syntaxhighlighterplugin.zip

and extract...

Click the New Tiddler link to the left, and Name the tiddler 'StyleSheetSyntaxHighlighter' Navigate to your unzipped archive and cut and paste the contents of 'SyntaxHighlighter.css' into your new tiddler.

Navigate to the Shadow tiddler 'StyleSheet' and add [[StyleSheetSyntaxHighlighter]]

Add another 'New Tiddler' named 'SyntaxHighlighterPlugin' and paste the contents of 'shPlugin.js' into this tiddler, then tag the tiddler with 'systemConfig'

Finish everything up by copying 'clipboard.swf' to the directory of your TiddlyWiki...

Enjoy ;)

My Wonderful Workspace

- 04-13-2009 8:16 am

I just wanted to post the amazing workspace that I built for myself a year and a half back or so in my closet. I started out with two boards of hard pine that I picked up at Home Depot. I fit the large 1 1/4 inch chunk of wood into the closet itself held up by wood tracers around the edges. Then I added a couple keyboard rails, and a spacious keyboard tray. Now that I think back, I wish I would have done a build log :(. Anywho, I fitted everything a few times, then stained the wood, and finished it off with a clear-coat. I proceeded to cut a wire hole in each corner, and screw in a PSU to the bottom right (seen in some of the pictures above my awesome laser printer [ML 2851 ND]). I added all the pictures on my flickr, so you can check out a few different angles... But here are my favorites:

I keep a lot of stuff on my desk. I took the large mousepad (I'll show you later in the thread) to take some pictures of the great wood.

From left to right desktop: (left tweeter, tea cups, zarafina tea maker, tea, 22" Viewsonic mounted on the wall, Make Daisy MP3 player [need to fix a contact], Surefire L7, center tweeter, knik-naks [whittled knife I made], potassium nitrate [smoke bombs :)],cd's, right tweeter)

From left to right keyboard tray: (Compaq 11800 [amazing], Red and Black workbook, guitar tuner, metronome, nokia n810 [atop an xtracpads hybrid])

From left to right underneath: (Black Box [4TB ZFS NAS server (2.7TB usable, 1 parity disk)], mini asus [videos, desktop, home server], power strip, clump of goodies [large sub, laser printer, sub controller, WRT 350N, DSL modem])

This is what my desk normally looks like. If if doesn't look neat and clean like this, it's overtaken by stuff that I've been working on, and too lazy to put away...

What's new?

- 04-08-2009 12:00 am

I would love to post some pictures of my new little toy (nokia n810) , but I'm too busy using it to type type this entry :) I've reprogrammed the darn thing over twenty times, and I've had it less than a week. I've flashed it with mer, poky, android, and of corse diablo. I'm probably not making much sense, but Im too lazy to post links atm. I plan on posting some pictures/videos of the device and how to flash. I just realized that I have a lot of new posts that I need to... um. post :)

eyeOS impressions & PKGBUILD

- 04-02-2009 12:00 am

I've followed the cloud os craze for a while now. I've tried a couple different implementations, and really haven't come across anything worth while. Well besides that I decided to try out eyeOS again. The last time I tried it out, it was a little difficult to install (multiple steps), the documentation wasn't the greatist, and it was a dysfunctional OS solution. My recent exploration into eyeOS start with a trip to my local AUR to see if there was a PKGBUILD for eyeOS? There was, yet it hadn't been updated in a long time, and it was abandoned. Well I jumped right on it and made a new PKGBUILD. I added a little instruction for install in the eyeos.install (called after pkg is installed). I proceeded to go to http://localhost/eyeos I was introduced to three fields: root password, repeat root password, and hostname. I entered the information and was greeted with a nifty login screen :)

I created a new account, logged in, and started to enjoy the new eyeOS (compared to the crap that I used a while ago)

I uploaded my PKGBUILD files via the upload utility, and was giddy to be able to select multiple files to upload. I opened it in a text editor and messed around with it. I tried the web browser, rss reader, and a couple other things.

I'm working on getting eyeSync working on my mac, yet have had no luck as of yet...

Installing applications in eyeOS

- 04-02-2009 12:00 am

Installing apps in eyeOS is as simple as logging in as root, and selecting the applications manager, and hitting install apps.

Pretty simple...

Kernel Compilation & Arch Linux

- 03-31-2009 12:00 am

Summary:

A brief history of the infamous kernel. Followed by an in depth evaluation on the Arch Linux PKGBUILD of the stock kernel26. In that I'll delve into the new outline of the PKGBUILD along with ways to customize (.config options, patches, how to prune for performance)

-- What is a kernel? --

The kernel is the magical gateway that allows your hardware to communicate with applications. The kernel allows 'User space' to call system calls to the 'Kernel space.' Such as manipulating a file on a disk (open/close/read/write), or registering CPU commands. This being said the kernel is one of the lowest points of abstraction. It's the crutch in which the whole of your computer is held up. The kernel manages resources such as CPU, memory, and I/O (disks, peripherals, displays, etc.). The kernel also allows for synchronization and communication between processes. (Inter-Process Communication). It also allows such processes a method to access the aforementioned hardware resources.

The linux kernel is monolithic in nature, yet can be optimized with modules. Modules allow your kernel to be as small as you want, or easily expanded to include everything and the kitchen sink. It also allows you update modules; remove, update, reinsert, and be on your way again. More on modules to follow...

-- kernel26-2.6.28 (PKGBUILD) --

Please usher in the all powerful PKGBUILD! (/me welcomes)

Check out the the PKGBUILD in it's entirety here:http://repos.archlinux.org/viewvc.cgi/kernel26/repos/core-i686/PKGBUILD?revision=29572&view=markup

And for all the other files hit them up on the svn:http://repos.archlinux.org/viewvc.cgi/kernel26/repos/core-i686

For the article, the PKGBUILD will be broken into it's multiple pieces, and given a little description.

------
1) Common Head
------

  1 # $Id$
2 # Maintainer: Tobias Powalowski 3 # Maintainer: Thomas Baechler 4 pkgname=kernel26 # Build stock -ARCH kernel
5 # pkgname=kernel26-custom # Build kernel with a different name
6 _kernelname=${pkgname#kernel26}
7 _basekernel=2.6.28
8 pkgver=${_basekernel}.7
9 pkgrel=2
10 _patchname="patch-${pkgver}-${pkgrel}-ARCH"
11 pkgdesc="The Linux Kernel and modules"
12 arch=(i686 x86_64)
13 license=('GPL2')
14 groups=('base')
15 url="http://www.kernel.org"
16 backup=(etc/mkinitcpio.d/${pkgname}.preset)
17 depends=('coreutils' 'kernel26-firmware>=2.6.28' 'module-init-tools' 'mkinitcpio>=0.5.20')
18 # pwc, ieee80211 and hostap-driver26 modules are included in kernel26 now
19 # nforce package support was abandoned by nvidia, kernel modules should cover everything now.
20 # kernel24 support is dropped since glibc24
21 replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi'
22 'alsa-driver' 'ieee80211' 'hostap-driver26'
23 'pwc' 'nforce' 'squashfs' 'unionfs' 'ivtv'
24 'zd1211' 'kvm-modules' 'iwlwifi' 'rt2x00-cvs'
25 'gspcav1' 'atl2' 'wlan-ng26')
26 install=kernel26.install
27 source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_basekernel.tar.bz2
28 ftp://ftp.archlinux.org/other/kernel26/${_patchname}.bz2
29 # the main kernel config files
30 config config.x86_64
31 # standard config files for mkinitcpio ramdisk
32 kernel26.preset)
33 optdepends=('crda: to set the correct wireless channels of your country')
34 md5sums=('d351e44709c9810b85e29b877f50968a'
35 'e535d668afb04a590f03a47356794579'
36 '3c47674afeae26616acd9dfc4060bd02'
37 '1f0005febea457f47f26af1726dbf1b2'
38 '25584700a0a679542929c4bed31433b6')

------

Lets break this down into it's relative pieces:
4) pkgname (ie. pacman -S kernel26)

6) _kernelname (uname -r)

7) _basekernel (well kernel w/o patches [2.6.28])

8) pkgver (kernel path version [2.6.28.7])

17) depends (coreutils, module-init-tools, and mkinitcpio are necessary. More on kernel26-firmware later)

26) install* (install file is crucial for mkinitcpio to execute correctly after your kernel has been properly compiled)

Everything else should make sense in this part of the PKGBUILD. If you're unfamiliar with any of the other variables I would peruse around the arch wiki, and read up on PKGBUILDS

------
2) Make Chunk
------

The next section is where the magic happens. Lines 40-75 start out with a variable to choose the correct .config. Pretend you are your computer (metaphysically) and imagine what you would do if given the following commands. Realize that makepkg does a little magic in the background, yet most everything else is very straightforward.

43) We dive into the extracted kernel directory extracted automagically by makepkg.

46) This is a great place to put patches. More on patches in the next section of the article. After the patches have been applied (or discounted) we move onto configuring the kernel.

Tobias/Thomas are nice and provide a preset .config for x86 & x86_64 (how nice of them).

48-52) determine the machine type and output the correct .config accordingly.

53-55) Check to see if you have '_kernelname' set, and if you do it will change the variable in your .config to match your custom name. '2.6.28-ARCH' is the default for this field.

57-75) Finishes the make. It grabs the correct name of the kernel and pops it into a nifty variable for use later (_kernver). What follows it is a nice block of commented code. The line that follows through just states that whatever the kernel has as defaults will be taken, and the build will commence. Later in the article we will take a look at how to make our own config, and strip out some on the un-necessary things in the kernel. After the config is taken care of, makepkg procedes to build the bzImage (boot image), and the rest of the kernel (modules and stuff)

------

 40 build() {
41 KARCH=x86
42
43 cd ${srcdir}/linux-$_basekernel
44 # Add -ARCH patches
45 # See http://projects.archlinux.org/git/?p=linux-2.6-ARCH.git;a=summary
46 patch -Np1 -i ${srcdir}/${_patchname} || return 1
47
48 if [ "$CARCH" = "x86_64" ]; then
49 cat ../config.x86_64 >./.config
50 else
51 cat ../config >./.config
52 fi
53 if [ "${_kernelname}" != "" ]; then
54 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
55 fi
56 # get kernel version
57 make prepare
58 _kernver="$(make kernelrelease)"
59 # load configuration
60 # Configure the kernel. Replace the line below with one of your choice.
61 #make menuconfig # CLI menu for configuration
62 #make xconfig # X-based configuration
63 #make oldconfig # using old config from previous kernel version
64 # ... or manually edit .config
65 ####################
66 # stop here
67 # this is useful to configure the kernel
68 #msg "Stopping build"
69 #return 1
70 ####################
71 yes "" | make config
72 # build!
73 make bzImage modules || return 1
74 mkdir -p ${pkgdir}/{lib/modules,boot}
75 make INSTALL_MOD_PATH=${pkgdir} modules_install || return 1

------
3) The rest
------

76-153) I will refrain from pasting this part of the PKGBUILD. A brief summary of what happens is this:

- Files are copied from working directory to installdir ($pkgdir)

- Miscellaneous files are copied from working dir to install dir.

161-179) This is where we continue:

------

161   # install fallback mkinitcpio.conf file and preset file for kernel
162 install -m644 -D ${srcdir}/kernel26.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset || return 1
163 # set correct depmod command for install
164 sed \
165 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
166 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
167 -i $startdir/kernel26.install
168 sed \
169 -e "s|source .*|source /etc/mkinitcpio.d/kernel26${_kernelname}.kver|g" \
170 -e "s|default_image=.*|default_image=\"/boot/${pkgname}.img\"|g" \
171 -e
"s|fallback_image=.*|fallback_image=\"/boot/${pkgname}-fallback.img\"|g" \
172 -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
173
174 echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${startdir}/pkg/etc/mkinitcpio.d/${pkgname}.kver
175 # remove unneeded architectures
176 rm -rf ${pkgdir}/usr/src/linux-${_kernver}/arch/{alpha,arm,arm26,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,mn10300,parisc,powerpc,ppc,s
390,sh,sh64,sparc,sparc64,um,v850,xtensa}
177 # remove the firmware
178 rm -rf ${pkgdir}/lib/firmware
179 }

------

162) Copies *.preset file (mkinitcpio vars) into install dir. To backstep a little, just in case your unsure what I mean by installdir. Makepkg works with two directories: pkg & src. src is where the package is extracted and compiled. Durring the compile you can specify to compile to the pkg dir, or copy the files over after you have finished your compile (ie. binaries)

164-167) Posts correct variables into your *.install file (uses a simple sed find and replace)

168-172) Pops correct vars into *.preset

174) This is the one line not to screw around with. It creates a .kver file to let mkinitcpio what kernel it's compiling.

176) Removes erroneous directories

178) I would remove this like if you plan to compile your own kernel. Just leave the firmware in place...

------

-- Patches --

Definitely take a peek at:http://wiki.archlinux.org/index.php/Kernel_Patches_and_Patchsets

This gives a great rundown on patches & patchsets ;)

Other than that, patches are for the tweakers at heart. If you would like to get a fraction more performance benefit then run with patches as opposed to attaching modules. Depending on what you want you might want to patch in the newest version of ext4. Or the latest version of OpenVZ. Or if you would really like to explore, dive into DRBD...

-- Modules --

Hooray, Modules! Modules are the easiest way to add functionality to a kernel. Not only do modules reduce the bloat of a once monolithic kernel. They also make it simple to upgrade seperate pieces of the kernel without restarting, or reloading a new kernel. There are certain limits, but they are far and wide, and when you run into one, it's simple to restart with a new kernel :)

------
/etc/rc.conf
------

MODULES=(!pcspkr r8169 slhc snd-mixer-oss snd-pcm-oss snd-hwdep
snd-page-alloc snd-pcm snd-timer snd snd-hda-intel soundcore nfs)

------

This is my modules line on my desktop. It's very simple. The pcsprk is disabled (!), and for the most part the rest of the things loaded are sound drivers.

That's not to say that I don't have more modules running. To check the currently running modules on your system run the 'lsmod' command. The output will look something similar to this:

------

[fsk141@FSK-Main ~]$ lsmod | more        
Module Size Used by
battery 14600 0
nls_cp437 8960 1
vfat 14464 1
fat 56760 1 vfat
usb_storage 112832 1
ipv6 309952 32

------

Hum, battery on a desktop? How absurd, well let's make sure that it's not a cmos battery, or anything else important with 'modinfo':

------

[fsk141@FSK-Main ~]$ modinfo battery
filename: /lib/modules/2.6.28-ARCH/kernel/drivers/acpi/battery.ko
license: GPL
description: ACPI Battery Driver
author: Alexey Starikovskiy author: Paul Diefenbaugh
alias: acpi*:PNP0C0A:*
depends:
vermagic: 2.6.28-ARCH SMP preempt mod_unload
parm: cache_time:cache time in milliseconds (uint)

------

Well, I don't need ACPI on my desktop, so lets remove it with 'modprobe -r battery' You need to run this as root or under sudo... By "removing it" it will remove it from the kernel. Likewise if you were to execute 'modprobe battery' it would insert the module.

-- Compiling & Tweaking--

To wrap things up lets go through a hypothetical scenario.

1) You edit your PKGBUILD and add the Viper Patchset (Best wishes to the late Vipercinus)

2) You replace 'yes "" | makeconfig' with 'make menuconfig' (Remove erroneous options, and modules) If you are unsure what something is, then pull up a trusty google page and look it up. For example if you use ext3 as your primary filesystem, then consider removing EXT2, EXT4, XFS, Reiser FS, etc. You might be suprised on how you can cut some time off boot by simply removing pieces from your kernel. (Leave the important stuff, otherwise you'll just end up with a useless pile of compiled junk)

3) 'makepkg' finishes, and you proceded to 'ls /boot/' and make sure that your mkinitcpio images were successfully created

4) Add a Grub entry:

------

title  Arch Linux
root (hd0,0)
kernel /boot/vmlinuz26-custom
root=/dev/sda1 ro
initrd /boot/kernel26-custom.img

------

5) Reboot and cross your fingers. If it reboots, and spits you back into a prompt then you're golden. Otherwise you will need to troubleshoot what you did wrong, or how you mucked things up.

------

Conclusion:

I wish you the best of luck with your kernel adventures, and Arch Linux in general. The process of building a kernel takes a lot of time to master, and is a very complicated affair. It's wonderful that the PKGBUILD is able to structure the process so nicely, and allow you create a package with a full kernel, and the instructions to run mkinitcpio, and create the correct boot images. I recommend trying out a couple different patchsets, and trying your hand at making a PKGBUILD of your own kernel. At the very least grab the default kernel, and compile it yourself to see what happens. I can recall the first time I compiled a program, and how confused yet joyous I was. I knew I did something, but I had no idea what that something amounted to. Now after compiling too many programs/kernels to count I look back, and recall the time I had learning. It was troublesome, and there weren't many resources that were able to help/step you through the whole process. I know that this isn't an all telling guide for kernel compiling. At the very least, I hope this peaks you interest to learn more.

Enjoy, Jonny Gerold (jonny@fsk141.com)

LMAO (This is why I dont do twitter)

- 03-24-2009 12:00 am

Gmail Tasks Application (Mac)

- 03-24-2009 12:00 am

I just built up a neat standalone task manager for macs.

For those of you that keep up with the times:

http://blogoscoped.com/archive/2009-03-03-n11.html

I was disappointed when this service went down, yet today I figured out a way to make Gmail tasks into a standalone application. Since I'm working on my mac I built a copy...

Download here:

http://dl.getdropbox.com/u/52078/Tasks.zip