Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Some code for creating timestamps | |
@months = qw(01 02 03 04 05 06 07 08 09 10 11 12); | |
@weekDays = qw(01 02 03 04 05 06 07); | |
($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime(); | |
$year = 1900 + $yearOffset; | |
$theTime = "$hour:$minute:$second, $weekDays[$dayOfWeek] $months[$month] $dayOfMonth, $year"; | |
if ( $dayOfMonth > 9 ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
###################################################################################### | |
# Script: count.pl | |
# Author: Jefferson Kirkland | |
# | |
# Description: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################################## | |
# Process Configuration File | |
# | |
# First, open the file and apply a file handle. | |
# Second, take the next record and store in a variable | |
# Third, chomp to remove the newline | |
# Fourth, split the line on the separator (change if needed) and store in variables | |
######################################################################################## | |
open(CONFIG, "./myfile.config"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Net::SMTP; | |
$smtp = Net::SMTP->new('here.com'); # connect to an SMTP server | |
$smtp->mail( 'user\@here.com' ); # use the sender's address here | |
$smtp->to('user\@there.com'); # recipient's address | |
$smtp->data(); # Start the mail | |
# Send the header. | |
$smtp->datasend("To: user\@there.com\n"); | |
$smtp->datasend("From: user\@here.com\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$host = 'localhost'; /* Set to location of mysql server */ | |
$dbname = 'database_name'; | |
$user = 'user_name'; | |
$pwd = 'password'; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('HTTP/1.1 403 Forbidden'); | |
?> | |
<html> | |
<head> | |
<title>Congratulations! You have been DENIED access</title> | |
</head> | |
<body> | |
<font size="4">You have been denied access because of the following reasons:<br /><br /> | |
1.) Too many failed login attempts, so you are likely brute forcing through logins.<br /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#color and git branch | |
parse_git_branch() {·· | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
export CLICOLOR=1 | |
export GREP_OPTIONS="--color" | |
export LSCOLORS=gxfxcxdxbxegedabagacad | |
PS1='\n\[\e[1;36m\]\w \[\e[m\]\[\e[1;33m\]$(parse_git_branch)\[\e[m\] \n> ' |