Skip to content

Instantly share code, notes, and snippets.

View jhannah's full-sized avatar

Jay Hannah jhannah

View GitHub Profile
# Here's an example of having BioPerl write an alignment into the middle
# of an HTML stream:
use strict;
use IO::Scalar;
use BIo::AlignIO;
my $html = "<h1>Blah!</h1>\n";
my $html_fh = new IO::Scalar \$html;
=================================
What I've learned so far...
=================================
[raymond] says that daily optimize is probably too much. Instead, only run when your data is 'churned'.
10:33 < deafferret> [raymond]: want to give me a clue about how to know if my data is churned?
10:34 < [raymond]> deafferret: SHOW GLOBAL STATUS LIKE 'Com_%'; -- look through that list, you'll find some interesting data points.
=================================
open my $in, "oma_repl_language_text.sql";
open (my $out, ">:encoding(UTF-8)", "utf8.sql");
while (<$in>) {
print $out $_;
}
my $answer;
while (! $answer) {
$answer = prompt();
}
if ($answer == 1) {
print "you chose foo\n";
} elsif ($answer == 2) {
print "you chose bar\n";
} elsif ($answer == 3) {
#!/usr/bin/perl
use strict;
use Bio::SeqIO;
my @files = `find /home/obcarter/2010/bacteria/ -name "*.gbk"`;
foreach my $file (@files) {
chomp $file;
my $in = Bio::SeqIO->new(-file => $file, -format => 'genbank');
while (my $seq = $in->next_seq) {
my %cities;
open my $in, "infile";
while (<$in>) {
my @line = split /\t/;
next unless $line[2] eq "H1N1";
next unless $line[6] eq "South Africa";
my @city = split /\//, $line[3];
$city = $city[1];
$cities{$city} = 1;
}
@jhannah
jhannah / Omni2::View::Runner
Created February 17, 2010 21:41
MooseX::Workers in action
Here's my most recent stack...
View/System/ows/cache/runner.pl
View/Runner.pm
MooseX::Workers
Moose, POE
==========================================================
View/System/ows/cache/runner.pl
==========================================================
my $string = "abcdef";
my $newstring;
foreach my $letter (split //, $string) {
$newstring .= "[$letter]";
}
print "$newstring\n";
use strict;
use diagnostics;
use warnings;
use IPC::System::Simple qw(run system capture EXIT_ANY);
use WWW::Search;
$SIG{ALRM} = sub { die "timeout" };
my $random_word = random_dictionary_word();
my $oSearch = new WWW::Search('MSN');
use strict;
use warnings;
use diagnostics;
my %weeks;
open my $fh, "<", "weekConverter.txt" or die "Can't open weeks file: $!";
while (<$fh>) {
chomp;
my ($date, $week) = split /\t/;
}