summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-04-07 16:43:27 +0200
committerDaniel Friesel <derf@finalrewind.org>2014-04-07 16:43:27 +0200
commit54d8fee5b391fa72d3af1501136e117a465510a0 (patch)
treecb3cf46e2998a3183fe5b9a4696c6dda81c7cba7 /bin
parentddd081d19d7d4e61ec88f282ecb0b03f37a8fc09 (diff)
remove vnet (dead and nonfunctional)HEADmaster
Diffstat (limited to 'bin')
-rwxr-xr-xbin/vnet142
1 files changed, 0 insertions, 142 deletions
diff --git a/bin/vnet b/bin/vnet
deleted file mode 100755
index ebc560b..0000000
--- a/bin/vnet
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/usr/bin/env perl
-## Copyright © 2010 by Daniel Friesel <derf@finalrewind.org>
-## License: WTFPL <http://sam.zoy.org/wtfpl>
-## 0. You just DO WHAT THE FUCK YOU WANT TO.
-use strict;
-use warnings;
-use 5.010;
-
-use autodie;
-
-use GD;
-use Getopt::Std;
-use Term::ANSIColor;
-use LWP::UserAgent;
-
-my %opts;
-my $alpha;
-my $share = $0;
-my ($ext_ip, $int_ip);
-
-sub get_ext_ip {
-
- if (-d '/sys/class/net/ppp0') {
- return qq{-};
- }
-
- my $ua = LWP::UserAgent->new(
- env_proxy => 0
- );
- my $re = $ua->get('http://derf.homelinux.org/cgi-bin/clientinfo/ip.cgi');
-
- if ($re->is_success()) {
- my $text = $re->decoded_content();
- chomp $text;
- return $text;
- }
- else {
- return qq{?};
- }
-}
-
-sub get_int_ip {
- my $wlan = qx{ifdata -pa wlan0 2> /dev/null};
- my $lan = qx{ifdata -pa lan 2> /dev/null};
-
- chomp $wlan;
- chomp $lan;
-
- if (length($wlan)) {
- return $wlan;
- }
- else {
- return $lan;
- }
-}
-
-sub show_net_png {
- my ($w, $h) = (160, 32);
- my $im = GD::Image->new($w, $h);
- my $icon = GD::Image->newFromPng("${share}/network.png", 1);
-
- my $black = $im->colorAllocateAlpha( 0, 0, 0, $alpha);
- my $white = $im->colorAllocateAlpha(255, 255, 255, $alpha);
- my $bg = $im->colorAllocateAlpha(255, 255, 255, 127);
-
- my $ip_ext = get_ext_ip();
- my $ip_int = get_int_ip();
-
- $im->filledRectangle(0, 0, $w - 1, $h - 1, $bg);
-
- $im->string(gdMediumBoldFont, 37, 1, $ip_ext, $black);
- $im->string(gdMediumBoldFont, 36, 0, $ip_ext, $white);
-
- $im->string(gdMediumBoldFont, 37, 17, $ip_int, $black);
- $im->string(gdMediumBoldFont, 36, 16, $ip_int, $white);
-
- $im->copy($icon, 0, 0, 0, 0, 32, 32);
-
- open(my $out_fh, '>', '/tmp/vnet.png');
- binmode $out_fh;
- print $out_fh $im->png();
- close($out_fh);
-}
-
-sub show_net_console {
- printf(
- "int: %s\next: %s\n",
- get_int_ip(),
- get_ext_ip(),
- );
-}
-
-if (-l $share) {
- my $link = readlink($share);
- $share =~ s{ [^/]+ $ }{}x;
- $link =~ s{ / bin / vnet $ }{}x;
- $share .= "${link}/share";
-}
-else {
- $share =~ s{ / bin / vnet $ }{}x;
- $share .= '/share';
-}
-
-getopts('a:cfg', \%opts);
-$alpha = $opts{'a'} // 0;
-
-if ($opts{'c'}) {
- show_net_console();
-}
-elsif ($opts{'g'}) {
- show_net_png();
-}
-
-if ($opts{'f'}) {
- exec('feh', '/tmp/vnet.png');
-}
-
-__END__
-
-=head1 NAME
-
-=head1 SYNOPSIS
-
-=head1 DESCRIPTION
-
-=head1 OPTIONS
-
-=head1 EXIT STATUS
-
-=head1 CONFIGURATION
-
-=head1 DEPENDENCIES
-
-=head1 BUGS AND LIMITATIONS
-
-=head1 AUTHOR
-
-Copyright (C) 2010 by Daniel Friesel E<lt>derf@finalrewind.orgE<gt>
-
-=head1 LICENSE
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.