Skip to content

Instantly share code, notes, and snippets.

Avatar

Jefferson Kirkland numberwhun

View GitHub Profile
@numberwhun
numberwhun / My Prompt
Last active Sep 28, 2015
My current ps1 prompt
View My Prompt
PS1="\n\[\033[32;1m\]It's \t\[\033[33;1m\] Currently browsing \[\033[1;36m\]\w \[\033[33;1m\]directory\n\[\033[34;1m\]\ `if [ \$? = 0 ]; then echo \[\e[37m\]Last Command Was Successfully Executed \[\e[32m\]^_^\[\e[0m\]; else echo \[\e[37m\ ]Smeggin Hell exit! Last Command Was Unknown \[\e[32m\]O_O\[\e[0m\]; fi\` \n\[\033[31m\]What is thy bidding, my master? \n\n\[\033[34;1m\]"
The above seems to work on Ubuntu. On CentOS I use the following subset of the above:
PS1="\n\[\033[32;1m\]It's \t\[\033[34;1m\] Current Directory: \[\033[1;36m\]\w \[\033[33;1m\] \n\[\033[31m\]What is thy bidding, my master? \n\[\033[36;1m\]> "
This produces the following output:
It's 08:32:32 Current Directory: ~
@numberwhun
numberwhun / getlinks.pl
Created Nov 28, 2011
Script to download files with a specific extension from a specific URL
View getlinks.pl
@numberwhun
numberwhun / split_string_into_characters.pl
Created Nov 28, 2011
Split a string into its individual characters
View split_string_into_characters.pl
#!/usr/bin/perl
use strict;
use warnings;
#########################################################################
# Script: characters.pl
# Author: Jefferson Kirkland
# Date: December 11, 2007
#
@numberwhun
numberwhun / inline_config_file_into_a_hash.pl
Created Nov 28, 2011
Process an inline config file into a hash
View inline_config_file_into_a_hash.pl
#####################################################################################
# This code takes a config file that contains a single line of data that has all of
# the needed values separated by a pipe (|) character and parses each line
# into an array. Then, each element of the array is assigned to its respective key
# in the hash.
#
# Here is an example of what the config file should look like:
#
# /export/home/partd001/|subconnector|rck6701ftps02.bcbsmamd.net|sbsbprod|ty5jk3h
#
@numberwhun
numberwhun / doauditdb.pl
Created Nov 28, 2011
Code used to audit a database and ensure all fields are defined as per the schema.
View doauditdb.pl
# I wrote this code at one of my jobs because the databases that we had for our customers had issues.
# It ended up that the csv files that were being produced did not have correct values in the
# corresponding fields. This generally happened when people added fields in the middle of the schema
# file, instead of at the end like they should have. This code was run on databases that, at the
# time, were as large as 1.5 terabytes. The function would spit out the differences between the schema and the actual defined table definitions and it was then my job to make the modifications on the fly to the live tables to correct the issues. Sometimes I simply modified the code that was used
# to populate the csv files as it seemed a bit easier, but most of the mods had to be to the database
# table definitions themselves. Hair raising for a 1.5 terabyte database, let me just say.
# I wrote this function, which was added to a larger file containing a bunch of handy functions, and
# when run, compared the databas
@numberwhun
numberwhun / installedModules.pl
Created Nov 28, 2011
List installed modules and their versions
View installedModules.pl
# This prints out a list of all the installed Perl modules on the system and the version of each one
# that is currently installed
use strict;
use warnings;
use ExtUtils::Installed;
my $instmod = ExtUtils::Installed->new();
foreach my $module ($instmod->modules()) {
my $version = $instmod->version($module) || "???";
@numberwhun
numberwhun / gist:1399592
Created Nov 28, 2011
Project Ideas for class
View gist:1399592
I actually found this on a college programming course site. Its a list of ideas for the class to draw from for project ideas.
###################################################################3
Ideas for the class project
Here are some rough notes that may be useful for deciding on a topic for the class project. You should treat the following as starting points for further discussion and development, not as canned project suggestions (which you can find elsewhere). In particular, the following are not intended to serve as replacements for discussing project ideas and plans (among project team members and with the instructor and TA).
Note that some of these are too simple for a project and others may be too complex. Treat the following merely as a collection of ideas from which you can pick some you like, combining them to get a project that both interests you and is sufficiently challenging from a technical viewpoint. You are encouraged to stop by during office hours to discuss any of the following that
@numberwhun
numberwhun / gist:1399627
Created Nov 28, 2011
Convert Date-Time to Epoch Seconds
View gist:1399627
#!/usr/bin/perl
use strict;
use warnings;
use Time::Local;
##############################################################
# Use this snippet carefully. The date is in a specific
# format, but you can code to pull appart another date format
# if you wish.
View setup_ftp_vars.pl
# REMEMBER: Pull these from a configuration file, DO NOT hard code these.
#######################################################
# Setup the variables with the FTP information
#######################################################
my $FTPADDR = "";
my $FTPUSER = "";
my $FTPPSWD = "";
@numberwhun
numberwhun / num2name.pl
Created Nov 28, 2011
Print names corresponding to numbers in a list
View num2name.pl
#################################################################################
# Script: nuum2name.pl
# Author: Jefferson Kirkland
# Company: JK Web Development
# Copyright: 2008
#
# Description: This script takes a list of numbers, supplied by the user, and
# converts the numbers into names. The script then prints them out to show the
# user what names the numbers corresponded to.
#