Rawr!!!

Standardy CSS

Written by
June 26th, 2011

In the general spirit of reset.css (http://meyerweb.com/eric/tools/css/reset), and to help out with some styling for the Fsk141 Framework I’ve pulled together what I call Standardy.css. What it is should help make a standard look across all browsers (well a starting point anyway) For everything that reset.css takes away, this puts it back in a cross browser compliant css method. I just whipped this up last night, and have started testing; everything seems to be alright thus far.
You can view standardy.css below; or download from here: standardy.css

/* Standardy CSS (to use in conjunction with reset.css)
 *
 * License: none (public domain)
 *
 * Pulled together from around the internet & optimized by Jonny Gerold <jonny@fsk141.com>
 *
 */

address,blockquote,body,dd,div,dl,dt,fieldset,form,frame,frameset,h1,h2,h3,h4,h5,h6,iframe,noframes,object,ol,p,ul,applet,center,dir,hr,menu,pre { display:block; }
li { display:list-item; }
head { display:none; }
table { display:table; }
tr { display:table-row; }
thead { display:table-header-group; }
tbody { display:table-row-group; }
tfoot { display:table-footer-group; }
col { display:table-column; }
colgroup { display:table-column-group; }
td,th { display:table-cell; }
caption { display:table-caption; text-align:center; }
th { font-weight:bolder; text-align:center; }
body { line-height:1.33; padding:8px; }
h1 { font-size:2em; margin:.67em 0; }
h2 { font-size:1.5em; margin:.83em 0; }
h3 { font-size:1.17em; margin:1em 0; }
h4,p,blockquote,ul,fieldset,form,ol,dl,dir,menu { margin:1.33em 0; }
h5 { font-size:.83em; line-height:1.17em; margin:1.67em 0; }
h6 { font-size:.67em; margin:2.33em 0; }
h1,h2,h3,h4,h5,h6,b,strong { font-weight:bolder; }
blockquote { margin-left:40px; margin-right:40px; }
i,cite,em,var,address { font-style:italic; }
pre,tt,code,kbd,samp { font-family:monospace; }
pre { white-space:pre; }
big { font-size:1.17em; }
small,sub,sup { font-size:.83em; }
sub { vertical-align:sub; }
sup { vertical-align:super; }
s,strike,del { text-decoration:line-through; }
hr { border:1px inset; }
ol,ul,dir,menu,dd { margin-left:40px; }
ol { list-style-type:decimal; }
ol ul,ul ol,ul ul,ol ol { margin-bottom:0; margin-top:0; }
u,ins { text-decoration:underline; }
center { text-align:center; }
br:before { content:"\A"; }

Fsk141 Framework

Written by
April 27th, 2011

Just testing it out, might keep the site like this for a while. The idea of Fsk141 framework is to give site developers something very simple with NO EXISTING styling.

I know that if you’re a smart developer like me you want to write everything yourself, and don’t want to have to track down styling’s of others just to make something look how you want.

Why would I make something so… blank? Well I wanted something that I could easily start with to build more themes (mind you this is no where near complete, there is a lot to add, and probably stuff to remove). I played with a few of the existing frameworks, and to be honest they seemed a tad bit bloated, or not well commented, or just not what I was looking for. So when you cant find something that suits your needs, build it yourself!
I hope to add html5 doctype / functions to the framework next. The framework needs a lot of ids & classes added for ease of styling; I just added the basics for now.

Enjoy,

Fsk141

A lotto C

Written by
December 16th, 2010

Download Here:

http://dl.dropbox.com/u/52078/Development/C/lotto/lotto.c

——

I’ve been going though K&R C Programming Language lately & brushing up on my programming skills. All the while talking to a buddy of mine that programs frequently. He gave me a challenge to give him some lotto numbers for standard lotto & pick5. The final version is a pseudo random variation, but I don’t know enough programming know how yet to get it to be absolute, or even close to true random. Anywho about 30 minutes later I had a simple alteration whipped up like the following:


#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define NUMBERS 6 /* How many numbers do you want? */
#define MAX 46 /* Max random value */

int main (void) {
 int num;

 /* get 6 random numbers */
 srand ( time (NULL) ); /* make a random number based on unix time */

 printf ("Your lotto numbers are: n");
for ( num = 0; num < NUMBERS; num++ ) { /* repeat for how many numbers you want */
 if ( ( random = rand () % MAX ) == 0 ) /* prevents 0 from being outputted */
 printf ( "t%d", rand () % MAX );
  else
   printf ( "t%d", random );
 }

 printf ("n");
 return 0;
}

It will output something like the following:

Your lotto numbers are:
23    33    4    35    14    1

This will output 6 random numbers. The actual randomness is happening based on srand && it makes it random based on unix time. http://linux.die.net/man/3/srand has a nice little description of srand & rand, or if you’re at a terminal you can type ‘man srand’ and get some info.

After I finished this, low and behold he wanted pick5 too. (which is 5 sets of 6 numbers), well I added this & made a little prompt for ease of use. The following program is the complete solution. You can view it below or download it from my public dropbox link ^^ look at the top ^^:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define NUMBERS 6 /* How many numbers do you want? */
#define MAX 46 /* Max random value */

int main (void) {
 int num, pick5, type, random;

 printf ( "Hey Chris, what would you like to do today?nn>> Type number you wish to execute:n" );
 printf ( "(1) Standard Lotton" );
 printf ( "(2) Pick5 Lotton" );

 scanf ( "%d", &type );

 switch ( type ) {
 case 1: /* get 6 random numbers */
 srand ( time (NULL) ); /* make a random number based on unix time */

 printf ("Your lotto numbers are: n");

 for ( num = 0; num < NUMBERS; num++ ) { /* repeat for how many numbers you want */
 if ( ( random = rand () % MAX ) == 0 )
 printf ( "t%d", rand () % MAX );
 else
 printf ( "t%d", random );
 }
 printf ("n");
 break;

 case 2: /* get 5 sets of 6 random numbers */
 srand ( time (NULL) ); /* make a random number based on unix time */

 printf ("Here's five sets of lotto pics for ya: n");

 for ( pick5 = 0; pick5 < 5; pick5++ ) {
 printf ("Set %d:n", pick5);
 for ( num = 0; num < NUMBERS; num++ ) {
 if ( ( random = rand () % MAX ) == 0 )
 printf ( "t%d", rand () %MAX );
 else
 printf ( "t%d", random );
 }
 printf ("n");
 }
 break;

 default:
 printf ("You messed up stupid. Try againn");
 }

 return 0;
}

This will output something like the following:

[jgerold@jgerold-mbp13.smsi.com ~/Dropbox/Public/Development/C/lotto]$ ./lotto
Hey Chris, what would you like to do today?

>> Type number you wish to execute:
(1) Standard Lotto
(2) Pick5 Lotto
1
Your lotto numbers are:
23    33    4    35    14    1
[jgerold@jgerold-mbp13.smsi.com ~/Dropbox/Public/Development/C/lotto]$ ./lotto
Hey Chris, what would you like to do today?

>> Type number you wish to execute:
(1) Standard Lotto
(2) Pick5 Lotto
2
Here's five sets of lotto pics for ya:
Set 0:
 14    40    1    1    28    36
Set 1:
 15    45    17    11    44    45
Set 2:
 6    2    37    43    19    25
Set 3:
 37    4    31    16    11    9
Set 4:
 38    37    25    17    1    44

Chapod (Calvin & Hobbes Apod)

Written by
September 6th, 2010

Idea: http://www.reddit.com/r/pics/comments/d9zfg/i_used_to_change_my_desktop_background_every_day

APOD: http://apod.nasa.gov/apod/

Implementation: https://github.com/fsk141/scripts/blob/master/chapod

Download: https://raw.github.com/fsk141/scripts/master/chapod (wget, or right click & save as)

I made this a while ago, and thought some people would like to know that it’s working awesome.

Setup:

Change the RESOLUTION variable to fit your screen size

Usage: (Works on Mac & Linux)


chapod ## without any options will download everything & set your desktop bg

chapod  ## will set to any apod you want!

eg: chapod http://apod.nasa.gov/apod/ap110628.html

don’t forget to chmod +x if thing’s aren’t working out well.

If you would like it to auto-run every day:

 crontab -e # and add the following:
 5 12 * * *	$HOME/.scripts/scripts/chapod  

Requirements:

- Imagemagick

- Mac/Linux

- Curl

- feh (if on linux)

Program below:

#!/bin/bash

#################################################
# Calvin & Hobbes APOD #
# Version 1.2 (stupid convert) #
#################################################

#///////////////////////////////////////////////#
# Author: Jonny Gerold <jonny@fsk141.com> #
#///////////////////////////////////////////////#

#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

# Storage Directory
SDIR="$HOME/.chapod"

# Screen Resolution
RESOLUTION="1280x800"

# Raw Calvin & Hobbes foreground
RAWCH="http://dl.dropbox.com/u/52078/chblank.png"

# Base URL for apod
BURL="http://apod.nasa.gov/apod/"

# OS Check
OS=`uname -s`

# Where is convert
if [[ "$OS" == "Darwin" ]]; then
if [[ -x /usr/local/bin/brew ]]; then
IM="/usr/local/bin/convert"
## prolly should put in an else for macports
fi
else
IM="/usr/bin/convert"
fi

# If a url is specified use that, otherwise use apod
if [[ -n "$1" ]]; then

# Entered URL
EURL="$1"
IMAGEPATH=`curl $EURL 2>/dev/null | grep 'href="image' | cut -d\" -f2`
APOD="$BURL$IMAGEPATH"
else
IMAGEPATH=`curl $BURL 2>/dev/null | grep 'href="image' | cut -d\" -f2`
APOD="$BURL$IMAGEPATH"
fi

# Make SDIR
if [[ ! -d $SDIR ]]; then
mkdir $SDIR
fi

# Get the raw Calvin & Hobbes image
if [[ ! -e $SDIR/chblank.png ]]; then
curl $RAWCH -o $SDIR/chblank.png 2>/dev/null
fi

# Get the apod
if [[ -e $SDIR/apod.jpg ]]; then
rm $SDIR/apod.jpg
fi
curl $APOD -o $SDIR/apod.jpg 2>/dev/null

# Resize raw C&H image & apod
for image in apod.jpg chblank.png
do $IM $SDIR/$image -background transparent -resize $RESOLUTION^ -gravity south -extent $RESOLUTION $SDIR/tmp.$image
done

# Lets join them together
$IM $SDIR/{tmp.apod.jpg,tmp.chblank.png} -mosaic $SDIR/chapod.jpg

rm $SDIR/tmp.*

# Now lets set the background
if [[ $OS == "Darwin" ]]; then
osascript -e "tell application \"System Events\" to set picture of every desktop to \"$SDIR/$CHA\""
else
feh --bg-scale $SDIR/chapod.jpg &
fi

LISP (again), More links

Written by
July 28th, 2009

I’ve started up learning LISP once again. I’m going to start from the beginning of SICP (Structure and Interpretation of Computer Programming) I’ve gotten the introduction knocked out. If you would like to follow along check out my notes here. ATM I’m using DrScheme, but am looking for a simpler way of going about things…

——

I’ve added more static links to my array. Over the past couple days I’ve been trying to get my computerspace organized, and in the process I’ve added a lot of content to my blog. I hope it wasn’t all for nothing, and that at least someone reads it :)

Dotfiles, sort, for, idea!,

Written by
July 25th, 2009

First, I would like to introduce a new link to the right (the hard links) labeled “Dotfiles” This will include all the dot configuration files for my misc computers.

——

I messed up a little bit with renaming some files and renamed some .avi files to .jpg. To sort the problem out I needed to figure out what the bigger files were to easily determine which were movies, and which were not. An easy way to achieve a size sort is this:

du -h * ## basic size of files in a directory
---
du -h * | sort -n  ## Size Ascending (Smallest to Largest)
---
du -h * | sort -n -r ## Size Descending (Largest to Smallest)

[fsk141@Minifsk ~/2009-Black_Mountain]$ du -h *
---
1.9M	210.jpg
6.2M	211.avi
16M	212.avi
15M	213.avi
3.4M	214.jpg
50M	215.avi
14M	216.avi
3.4M	217.jpg
2.2M	218.jpg
36M	219.avi
5.3M	220.avi

[fsk141@Minifsk ~/2009-Black_Mountain]$ du -h * | sort -n
---
5.0M	029.jpg
5.3M	220.avi
5.7M	209.avi
6.2M	211.avi
13M	208.avi
14M	216.avi
15M	213.avi
16M	212.avi
36M	219.avi
50M	215.avi

——

I’ve been using for statements recently, and got some help from: http://www.freeos.com/guides/lsst/ch03sec06.html. I might write a little statement writeup (for, while, if, etc) But in the meantime I would like to share a couple that came in handy with some renames & fixes.

for i in 1 2 3 4
do mv $i.jpg $.avi
done
---
for ((  i = 0 ;  i < 20;  i++  ))
do mv $i.JPG $i.jpg
done

I love ‘for’ and ‘if’ statements, and need to get more into my “programming” mindset, and not waste so much time typing repetitive tasks.

——

IDEA!!!

So I love flickr, and backup all my images to my flickr account. (I need to make more public, but most are private) And I’ve printed pictures from snapfish in the past, but it’s a little pain to upload to flickr and snapfish. So I’m thinking up a way to upload to both at the same time. I believe that both flickr and snapfish allow you to upload .zip files, yet I’m unsure if you can email them .zip archives and they will extract and everything for you? If that’s possible then I will probably write up a script that zips up a directory and sends it to the respectable services. I’ll post once I get something up.

2.6.18 {i686 – PAE} [OpenVZ *newest* | DRBD 8.3.0

Written by
February 9th, 2009

How to compile 2.6.18 with newest DRBD.

It’s kinda a joke that OpenVZ just released a new RHEL5 kernel and it has DRBD 8.2.6 (meh) So I’m doing a short write up on the commands to semi-automatically build a 2.6.18 kernel with OpenVZ & DRBD 8.3.0. I’m choosing to do i686, but if you want to change it to x86_64 or remove PAE then just edit .config & download the correct OpenVZ patch.

mkdir -p /usr/src/kernels/2.6.18_vz_drbd_ibcs/src
cd /usr/src/kernels/2.6.18_vz_drbd_ibcs/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.tar.gz
wget http://oss.linbit.com/drbd/8.3/drbd-8.3.0.tar.gz
wget http://voxel.dl.sourceforge.net/sourceforge/linux-abi/ibcs-3_7.tgz
wget http://download.openvz.org/kernel/branches/rhel5-2.6.18/028stab060.2/patches/patch-92.1.18.el5.028stab060.2-combined.gz
wget http://download.openvz.org/kernel/branches/rhel5-2.6.18/028stab060.2/configs/kernel-2.6.18-i686-PAE.config.ovz

tar xzf linux-2.6.18.tar.gz -C ..
tar xzf drbd-8.3.0.tar.gz -C ..
mkdir ../ibcs
tar xzf ibcs-3_7.tgz -C ../ibcs
cp patch-92.1.18.el5.028stab060.2-combined.gz ..
cd ..

gunzip -c patch-92.1.18.el5.028stab060.2-combined.gz | patch -p0 patch-92.1.18.el5.028stab060.2-combined.gz

cd drbd-8.3.0
make KDIR=/usr/src/kernels/2.6.18_vz_drbd_ibcs/linux-2.6.18 kernel-patch
cp patch-linux-2.6.18-drbd-8.3.0 ..
cd ..
patch -p0 < patch-linux-2.6.18-drbd-8.3.0

cd linux-2.6.18
cp ../src/kernel-2.6.18-i686-PAE.config.ovz ./.config
make menuconfig

After you run: make menuconfig, this is the one important thing that you need to change…

Device Drivers > Block devices >     DRBD Distributed Replicated Block Device support

Then build the kernel:

time make -j7 rpm

Now install, and enjoy ;)

Make the initrd image:

mkinitrd /boot/initrd-2.6.18-PAE.img 2.6.18-prep

Add this to /boot/grub/menu.lst

title CentOS (2.6.18 OPENVZ|DRBD)
        root(hd0,0)
        kernel /vmlinuz-2.6.18-prep ro root=LABEL=/
        initrd /initrd-2.6.18-PAE.img

Guile arrow fix

Written by
December 1st, 2008

I got to liking guile right off the bat as a lisp working environment. Yet it bugged me that you couldn’t use the up and down arrows to see your previous entries. Well here is the fix:

(use-modules (ice-9 readline)) (activate-readline)

If you would like it to automagically be applied on startup then edit ~/.guile:
Add the following line:

(use-modules (ice-9 readline)) (activate-readline)

SICP, LISP, Clisp, GCL, Guile, LISP is kewl…

Written by
November 24th, 2008

So I’ve gone back to the stoneage, and am learning LISP (circa 1958). I’m doing this not only to get a grasp on programming, but to learn the logic of programming. I’m going by the book and am using Structure and Interpretation of Computer Programs (SICP). It’s avaliable for free online, and is an awesome book. This sums up the book (it’s the first page):

This book is dedicated, in respect and admiration, to the spirit that lives in the computer.

I think that it’s extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customers got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don’t think we are. I think we’re
responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don’t become missionaries. Don’t feel as if you’re Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don’t feel as if the key to successful computing is only in your hands. What’s in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.

Alan J. Perlis (April 1, 1922-February 7, 1990)

Onto the environment. I’ve found three LISP environments.

Clisp (General LISP)

GCL (General LISP)

Guile (Scheme)

Since the book deals with scheme as opposed to general lisp, I’m probably going to use guile. I’ve just been introduced to the world of lisp, so my pick might change as time goes on.