Rawr!!!

Fsk141 Framework

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

December 16th, 2010 by

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)

September 6th, 2010 by

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