gron transforms JSON into discrete assignments to make it easier to grep for what you want and see the absolute ‘path’ to it. It eases the exploration of APIs that return large blobs of JSON but have terrible documentation. ▶ gron “https://api.github.com/repos/tomnomnom/gron/commits?per_page=1” | fgrep “commit.author” json[0].commit.author = {}; json[0].commit.author.date = “2016-07-02T10:51:21Z”; json[0].commit.author.email = “mail@tomnomnom.com”; json[0].commit.author.name ..
Category : PERL snippets
Traverses all integer columns checking for capacity limits. #!/usr/bin/env perl #use 5.010; #use strict; #use warnings; # Richard L. Byrd, written sometime in the 90s and improved bit by bit over the next 20 years # # 2009-01-27: While originally written to take a configfile input on the CLI (–configfile=xxxxx.cfg) I’ve hacked # that out ..
This is a simple script that interactively converts an IP address to its decimal equivalent. This can sometimes be used to bypass web content filtering devices as not all will convert the decimal to an IP and then a hostname. #!/usr/bin/perl # # prompt for an IP print “Enter an IP Address: “; # get ..
#!/usr/bin/perl # query the system through the generic sysctl(8) interface # (this does not require special priviledges) my $sysctl = {}; my $sysctl_output = `/sbin/sysctl -a`; foreach my $line (split(/n/, $sysctl_output)) { if ($line =~ m/^([^:]+):s+(.+)s*$/s) { $sysctl->{$1} = $2; } } # round the physical memory size to the next power of two which ..
Quickie to add a semicolon to end of non-commented lines (useful paired with the SHOW GRANTS bash script) #!/usr/bin/perl — open DATA, “$ARGV[0]”; while () { $liner=$_; if (“$liner” =~ /^#/) { print $liner; } else { chomp($liner); print “$liner” . “;n”; } } c..