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
sub clearScreen{ | |
system $^O eq 'MSWin32' ? 'cls' : 'clear'; | |
} |
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
my $switchName = "Debug Switch"; | |
open($switchFileHandle,'<',$switchFile) || warn "cant open switch file $!"; | |
$switch = <$switchFileHandle>; | |
close($switchFileHandle); | |
chomp($switch); | |
if($switch){$switch = "ON";} | |
else{$switch = "OFF";} | |
$switchString = "$switchName($switch)"; |
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
# get the submodule initially | |
git submodule add ssh://bla submodule_dir | |
git submodule init | |
# time passes, submodule upstream is updated | |
# and you now want to update | |
# change to the submodule directory | |
cd submodule_dir |
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 Data::Dumper; | |
$Data::Dumper::Sortkeys =1; | |
#$Data::Dumper::Sortkeys = sub { [reverse sort keys %{$_[0]}] }; #reverse order |
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
@arr = qw(1 2 3 4 5 6 7 8 9 10); | |
use Data::Dumper; | |
#print Dumper(@arr); | |
printme(1,2,\@arr,4); | |
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 strict; | |
use warnings; | |
use Time::Local; | |
my $sec = 0; | |
my $min = 0; | |
my $hours = 0; | |
my $day = 28; #(days are 1-31) | |
my $month = 5; #(months are 0-11) | |
my $year = 2013; |
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
#grep recursively | |
find . -type f -exec grep -n "stuff" {} \; -print | |
#count files in directory | |
ls -1 <targetdir> | wc -l | |
#put contents of one file at end of another | |
cat ./this-file >> ./into_this-file | |
# remove results of ls |
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
#replace file with file name and the entire contents get printed with line numbers to screen | |
perl -n -e 'print "$. - $_"' file | |
#or | |
perl -p -e '$_ = "$. - $_"' file |
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 | |
// Connects to your Database | |
mysql_connect("db.host", "uname", "pwd") or die(mysql_error()); | |
mysql_select_db("ectmenu") or die(mysql_error()); | |
$data = mysql_query("SELECT * FROM pizza") or die(mysql_error()); | |
while($info = mysql_fetch_array( $data )) | |
{ // here is the menu code below | |
print"<p> |
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 | |
#recAdd.pl By: Andrew Hayes <http://AndrewHay.es/> | |
#Copyright (c) 2012 Andrew Hayes | |
# | |
# This perl script recursively adds a given number to every number between it and zero. | |
# | |
use strict; | |
use warnings; | |
use Scalar::Util qw(looks_like_number); |