Skip to content

Instantly share code, notes, and snippets.

View n7st's full-sized avatar
🌶️
Working from home

Mike Jones n7st

🌶️
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am n7st on github.
  • I am netsplit (https://keybase.io/netsplit) on keybase.
  • I have a public key whose fingerprint is 3260 48F0 FBB4 D830 C3E5 DCBD BB14 DF4E 39F9 0DB9

To claim this, I am signing this object:

@n7st
n7st / .bashrc
Created February 24, 2015 13:16
Evil .bashrc
export PS1="\nYou are in a room with many doors, all alike\n# "
alias cd="echo That door is locked #"
alias pwd="echo You are lost #"
alias ls="echo It is too dark to see anything #"
alias cat="echo It is too dark to see anything #"
alias vi="echo You\\'re not strong enough to perform that action #"
alias startx="echo I don\\'t understand #"
alias exit="echo You don\\'t know the way out #"
alias sudo="echo You have been eaten by a Grue #"
@n7st
n7st / ddns.sh
Created March 8, 2015 16:15
Basic "dynamic DNS" subdomain updater thingy
#!/bin/bash
# Find your current IP address
ip=`dig +short myip.opendns.com @resolver1.opendns.com`
# Subdomain to update
subdomain="SUBDOMAIN_HERE"
# Example for Linode DNS
api_key="API_KEY_HERE"
@n7st
n7st / albumsbyyear.pl
Last active October 16, 2015 09:24
Report albums in your music directory per year
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
# Dates to report between ($in 2000, $out 2015)
my ($in, $out);
my $output = './albums_per_year_output/';
Getopt::Long::GetOptions(
@n7st
n7st / cronbot.pl
Last active November 12, 2015 17:19
IRC/cron example
#!/usr/bin/perl
use Modern::Perl;
use POE qw/Component::IRC Component::Cron/;
my @schedule;
my ($irc) = POE::Component::IRC->spawn();
my %config = (
# Connection info
#!/usr/bin/env perl -w
use strict;
use warnings;
use Math::Round;
sysinfo();
sub sysinfo {
my ($args, $server, $win_item);
@n7st
n7st / wake_server.sh
Created March 22, 2016 16:52
Script to put on crontab. Wakes a server if IP provided as parameter (e.g. 192.168.1.98) is currently connected to the network.
#!/usr/bin/env bash
# $1 should be an IP address
/usr/sbin/arp -d $1 > /dev/null 2>&1;
/usr/bin/arp-scan -l > /dev/null 2>&1;
[[ $(/usr/sbin/arp -n $1 | grep "ether") ]] && /usr/sbin/etherwake -b ETHERNET_ADDRESS_OF_SERVER_HERE;
@n7st
n7st / alias.zsh
Last active May 3, 2016 22:06
pod sub alias
pod_subs () {
awk '
BEGIN { print "=over 4\n" }
/sub / { printf "=item C<%s()>\n\n", $2 }
END { print "=back" }
' $1
}
@n7st
n7st / suspend.sh
Last active June 14, 2016 07:30
Scripts to sleep and wake machines if I'm at home
#!/usr/bin/env bash
set -uf -o pipefail;
usage="./suspend.sh 22";
: ${1?"Usage: $0 SSH port ($usage)"}
inbound=$(netstat -n --protocol inet | grep ":$1");
if [[ "$inbound" = "" ]];
@n7st
n7st / DateMath.pl
Last active September 22, 2016 18:45
DateMath.pl
#!/usr/bin/env perl
use strict;
use warnings;
use DateTime;
use Data::Printer;
my $start = DateTime->new(month => 02, year => 16);
my $end = DateTime->new(month => 10, year => 16);