mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-16 17:09:33 +01:00
Update modules
This commit is contained in:
parent
e7f5d2e9b0
commit
8b8020c301
@ -10,7 +10,7 @@ my $command = join(' ', @ARGV);
|
|||||||
|
|
||||||
my @args = split(' ', $command); # because @ARGV may be one quoted argument
|
my @args = split(' ', $command); # because @ARGV may be one quoted argument
|
||||||
if (@args < 2) {
|
if (@args < 2) {
|
||||||
print "Usage: cdecl <explain|declare|cast|set|...> <code>, see http://linux.die.net/man/1/cdecl\n";
|
print "Usage: cdecl <explain|declare|cast|set|...> <code>, see http://linux.die.net/man/1/cdecl (Don't use this command. Use `english` instead.)\n";
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,3 +23,5 @@ chomp $result;
|
|||||||
$result =~ s/\n/, /g;
|
$result =~ s/\n/, /g;
|
||||||
|
|
||||||
print $result;
|
print $result;
|
||||||
|
print " (Don't use this command. It can only handle C90 declarations -- poorly. Use `english` instead, which can translate any complete C11 code.)" if $result =~ m/^declare/;
|
||||||
|
print "\n";
|
||||||
|
@ -131,6 +131,7 @@ sub execute {
|
|||||||
gdb $in, "break $main_end\n";
|
gdb $in, "break $main_end\n";
|
||||||
gdb $in, "set width 0\n";
|
gdb $in, "set width 0\n";
|
||||||
gdb $in, "set height 0\n";
|
gdb $in, "set height 0\n";
|
||||||
|
gdb $in, "catch exec\n";
|
||||||
gdb $in, "run < .input\n";
|
gdb $in, "run < .input\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@ sub initialize {
|
|||||||
$self->{options_nopaste} = '-fno-diagnostics-show-caret';
|
$self->{options_nopaste} = '-fno-diagnostics-show-caret';
|
||||||
$self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile';
|
$self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile';
|
||||||
|
|
||||||
|
$self->{default_options} .= ' -Werror' if defined $self->{nick} && $self->{nick} =~ m/marchelz/i;
|
||||||
|
|
||||||
$self->{prelude} = <<'END';
|
$self->{prelude} = <<'END';
|
||||||
#define _XOPEN_SOURCE 9001
|
#define _XOPEN_SOURCE 9001
|
||||||
#define __USE_XOPEN
|
#define __USE_XOPEN
|
||||||
|
@ -20,6 +20,8 @@ sub initialize {
|
|||||||
$self->{options_nopaste} = '-fno-diagnostics-show-caret';
|
$self->{options_nopaste} = '-fno-diagnostics-show-caret';
|
||||||
$self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile';
|
$self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile';
|
||||||
|
|
||||||
|
$self->{default_options} .= ' -Werror' if defined $self->{nick} && $self->{nick} =~ m/marchelz/i;
|
||||||
|
|
||||||
$self->{prelude} = <<'END';
|
$self->{prelude} = <<'END';
|
||||||
#define _XOPEN_SOURCE 9001
|
#define _XOPEN_SOURCE 9001
|
||||||
#define __USE_XOPEN
|
#define __USE_XOPEN
|
||||||
|
@ -20,6 +20,8 @@ sub initialize {
|
|||||||
$self->{options_nopaste} = '-fno-diagnostics-show-caret';
|
$self->{options_nopaste} = '-fno-diagnostics-show-caret';
|
||||||
$self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile';
|
$self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile';
|
||||||
|
|
||||||
|
$self->{default_options} .= ' -Werror' if defined $self->{nick} && $self->{nick} =~ m/marchelz/i;
|
||||||
|
|
||||||
$self->{prelude} = <<'END';
|
$self->{prelude} = <<'END';
|
||||||
#define _XOPEN_SOURCE 9001
|
#define _XOPEN_SOURCE 9001
|
||||||
#define __USE_XOPEN
|
#define __USE_XOPEN
|
||||||
|
@ -15,7 +15,7 @@ sub initialize {
|
|||||||
|
|
||||||
$self->{sourcefile} = 'prog.c';
|
$self->{sourcefile} = 'prog.c';
|
||||||
$self->{execfile} = 'prog';
|
$self->{execfile} = 'prog';
|
||||||
$self->{default_options} = '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -Wshadow -std=c11 -lm -Wfatal-errors -fsanitize=integer,undefined,address,alignment';
|
$self->{default_options} = '-Wextra -Wall -Wno-unused -Wno-unused-parameter -pedantic -Wfloat-equal -Wshadow -std=c11 -lm -Wfatal-errors -fsanitize=integer,undefined,address,alignment';
|
||||||
$self->{options_paste} = '-fcaret-diagnostics';
|
$self->{options_paste} = '-fcaret-diagnostics';
|
||||||
$self->{options_nopaste} = '-fno-caret-diagnostics';
|
$self->{options_nopaste} = '-fno-caret-diagnostics';
|
||||||
$self->{cmdline} = 'clang-3.7 -ggdb -g3 $sourcefile $options -o $execfile';
|
$self->{cmdline} = 'clang-3.7 -ggdb -g3 $sourcefile $options -o $execfile';
|
||||||
|
@ -77,11 +77,13 @@ sub postprocess {
|
|||||||
|
|
||||||
my $input = $self->{input};
|
my $input = $self->{input};
|
||||||
|
|
||||||
|
print "writing input [$input]\n";
|
||||||
|
|
||||||
$input =~ s/(?<!\\)\\n/\n/mg;
|
$input =~ s/(?<!\\)\\n/\n/mg;
|
||||||
$input =~ s/(?<!\\)\\r/\r/mg;
|
$input =~ s/(?<!\\)\\r/\r/mg;
|
||||||
$input =~ s/(?<!\\)\\t/\t/mg;
|
$input =~ s/(?<!\\)\\t/\t/mg;
|
||||||
$input =~ s/(?<!\\)\\b/\b/mg;
|
$input =~ s/(?<!\\)\\b/\b/mg;
|
||||||
|
|
||||||
$input =~ s/\\\\/\\/mg;
|
$input =~ s/\\\\/\\/mg;
|
||||||
|
|
||||||
open(my $fh, '>', '.input');
|
open(my $fh, '>', '.input');
|
||||||
|
@ -62,8 +62,3 @@ Fnord invented the green hubcap.
|
|||||||
Fnord is why doctors ask you to cough.
|
Fnord is why doctors ask you to cough.
|
||||||
Fnord is the "ooo" in varooom of race cars.
|
Fnord is the "ooo" in varooom of race cars.
|
||||||
Fnord uses two bathtubs at once.
|
Fnord uses two bathtubs at once.
|
||||||
I cannot escape them / No matter how I try / They wait for me everywhere / I cannot pass them by.
|
|
||||||
Driving down the street / I see "Jesus Is Lord" / And then immediately after / I hear the word "FNORD!"
|
|
||||||
Innocuous sayings and parables / And on the evening news / I hear the word "FNORD!" / And suddenly I'm confused
|
|
||||||
I sit alone in my room / And I'm feeling rather bored / I turn on the tube and guess what / I hear the word "FNORD!"
|
|
||||||
"Don't see the fnords and they won't eat you" / That's what I've heard the wisemen say / But I can't get away from those beasties / There's just no fucking way.
|
|
||||||
|
@ -22,6 +22,11 @@ my $arguments = join("%20", @ARGV);
|
|||||||
|
|
||||||
$arguments =~ s/\W$//;
|
$arguments =~ s/\W$//;
|
||||||
|
|
||||||
|
exit if $arguments =~ m{https?://www.irccloud.com/pastebin}i;
|
||||||
|
exit if $arguments =~ m{http://smuj.ca/cl/}i;
|
||||||
|
exit if $arguments =~ m{/man\d+/}i;
|
||||||
|
exit if $arguments =~ m{godbolt.org}i;
|
||||||
|
exit if $arguments =~ m{man\.cgi}i;
|
||||||
exit if $arguments =~ m{wandbox}i;
|
exit if $arguments =~ m{wandbox}i;
|
||||||
exit if $arguments =~ m{ebay.com/itm}i;
|
exit if $arguments =~ m{ebay.com/itm}i;
|
||||||
exit if $arguments =~ m/prntscr.com/i;
|
exit if $arguments =~ m/prntscr.com/i;
|
||||||
@ -136,11 +141,13 @@ if($distance / $length < 0.75) {
|
|||||||
exit if $t !~ m/\s/; # exit if title is only one word -- this isn't usually interesting
|
exit if $t !~ m/\s/; # exit if title is only one word -- this isn't usually interesting
|
||||||
exit if $t =~ m/^Gerrit Code Review$/i;
|
exit if $t =~ m/^Gerrit Code Review$/i;
|
||||||
exit if $t =~ m/^Public Git Hosting -/i;
|
exit if $t =~ m/^Public Git Hosting -/i;
|
||||||
|
exit if $t =~ m/git\/blob/i;
|
||||||
|
exit if $t =~ m/\sdiff\s/i;
|
||||||
exit if $t =~ m/- Google Search$/;
|
exit if $t =~ m/- Google Search$/;
|
||||||
exit if $t =~ m/linux cross reference/i;
|
exit if $t =~ m/linux cross reference/i;
|
||||||
exit if $t =~ m/screenshot/i;
|
exit if $t =~ m/screenshot/i;
|
||||||
exit if $t =~ m/pastebin/i;
|
exit if $t =~ m/pastebin/i;
|
||||||
exit if $t =~ m/paste/i;
|
exit if $t =~ m/past[ea]/i;
|
||||||
exit if $t =~ m/^[0-9_-]+$/;
|
exit if $t =~ m/^[0-9_-]+$/;
|
||||||
exit if $t =~ m/^Index of \S+$/;
|
exit if $t =~ m/^Index of \S+$/;
|
||||||
exit if $t =~ m/(?:sign up|login)/i;
|
exit if $t =~ m/(?:sign up|login)/i;
|
||||||
@ -151,7 +158,7 @@ if (open my $fh, "<", "last-title-$nick.dat") {
|
|||||||
close $fh;
|
close $fh;
|
||||||
|
|
||||||
chomp $data[0];
|
chomp $data[0];
|
||||||
exit if $t eq $data[0] and scalar gettimeofday - $data[1] < 60;
|
exit if $t eq $data[0] and scalar gettimeofday - $data[1] < 1800;
|
||||||
}
|
}
|
||||||
|
|
||||||
open my $fh, ">", "last-title-$nick.dat";
|
open my $fh, ">", "last-title-$nick.dat";
|
||||||
|
@ -8,9 +8,9 @@ use strict;
|
|||||||
use LWP::Simple;
|
use LWP::Simple;
|
||||||
|
|
||||||
$_ = get("http://www.randominsults.net/");
|
$_ = get("http://www.randominsults.net/");
|
||||||
if (/<strong><i>(.*?)<\/i><\/strong>/) {
|
if (/<strong><i>(.*?)\s*<\/i><\/strong>/) {
|
||||||
print @ARGV,': ' if @ARGV;
|
print @ARGV,': ' if @ARGV;
|
||||||
print $1;
|
print "$1\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print "yo momma!";
|
print "yo momma!";
|
||||||
|
@ -25,8 +25,8 @@ if ($#ARGV < 0)
|
|||||||
$arguments = join(' ', @ARGV);
|
$arguments = join(' ', @ARGV);
|
||||||
my $orig_arguments = $arguments;
|
my $orig_arguments = $arguments;
|
||||||
|
|
||||||
$arguments =~ s/(the )*answer.*question of life(,? the universe and everything)?\s?/42/gi;
|
$arguments =~ s/(the )*answer.*question of life(,? the universe,? and everything)?\s?/42/gi;
|
||||||
$arguments =~ s/meaning of (life|existence|everything)?/42/gi;
|
$arguments =~ s/(the )*meaning of (life|existence|everything)?/42/gi;
|
||||||
|
|
||||||
if ($arguments =~ s/([^ ]+)\s+to\s+([^ ]+)\s*$//) {
|
if ($arguments =~ s/([^ ]+)\s+to\s+([^ ]+)\s*$//) {
|
||||||
@conversion = ($1, $2);
|
@conversion = ($1, $2);
|
||||||
|
@ -11,6 +11,11 @@ my $args = join ' ', @ARGV;
|
|||||||
|
|
||||||
my $qargs = quotemeta $args;
|
my $qargs = quotemeta $args;
|
||||||
|
|
||||||
|
if (not length $qargs) {
|
||||||
|
print "Usage: qalc <expression>\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
my $result = `qalc $qargs`;
|
my $result = `qalc $qargs`;
|
||||||
|
|
||||||
$result =~ s/^.*approx.\s+//;
|
$result =~ s/^.*approx.\s+//;
|
||||||
|
Loading…
Reference in New Issue
Block a user