Skip to content

Instantly share code, notes, and snippets.

View aduitsis's full-sized avatar

Athanasios Douitsis aduitsis

  • Juniper Networks
  • Athens, Greece
View GitHub Profile
@aduitsis
aduitsis / interfaces.c
Created May 31, 2019 22:48
Get list of interfaces in FreeBSD, detect which ones are loopbacks
/* compile with cc -o interfaces interfaces.c */
#include <ifaddrs.h>
#include <stdio.h>
#include <stdlib.h>
#include <net/if.h>
int main() {
struct ifaddrs *ifap;
if( getifaddrs(&ifap) < 0 ) {
perror("getifaddrs returned an error:");
@aduitsis
aduitsis / passwd2puppet.pl
Created February 18, 2015 14:41
Password file to puppet manifest
#!/usr/local/bin/perl -w
use v5.16;
use strict;
use warnings;
while(<>) {
chomp;
my ( $username, $password, $uid, $gid, $class, $change, $expire, $gecos, $home, $shell ) = split ':' // die "cannot parse $_";
#!/usr/bin/perl
use Gtk3 -init;
my $hello = Gtk3::MessageDialog->new (undef, 'modal', 'info', 'ok', "Hello world!");
$hello->set ('secondary-text' => 'This is an example dialog.');
$hello->run;
#!/usr/bin/perl
use v5.14;
use strict;
use warnings;
use JSON::XS;
use File::Slurp;
use Data::Dump;
use Data::Printer;
@aduitsis
aduitsis / yaml_validate.pl
Last active August 29, 2015 14:04
validate YAML
#!/usr/bin/perl -w
use strict;
use warnings;
use YAML;
use Data::Dumper;
my $slurp = do { local $/ ; <> };
my $data = Load( $slurp ) ;
@aduitsis
aduitsis / gist:5101097
Created March 6, 2013 17:19
Quick 'n' dirty SAML2 request decoder.
#!/usr/bin/perl -w
use strict;
use warnings;
use Carp;
use MIME::Base64;
use Compress::Zlib;
use URI;
use URI::QueryParam;
use XML::Canonical;