Skip to content

Instantly share code, notes, and snippets.

View keck's full-sized avatar

Nate Smith keck

  • Philadelphia, PA
View GitHub Profile
#!/bin/bash
COMMON_SUBDOMAINS=(www mail smtp pop imap blog en ftp ssh login)
if [[ "$2" == "x" ]]; then
dig +nocmd "$1" +noall +answer "${3:-any}"
wild_ips="$(dig +short "*.$1" "${3:-any}" | tr '\n' '|')"
wild_ips="${wild_ips%|}"
for sub in "${COMMON_SUBDOMAINS[@]}"; do
dig +nocmd "$sub.$1" +noall +answer "${3:-any}"
done | grep -vE "${wild_ips}"
dig +nocmd "*.$1" +noall +answer "${3:-any}"
aless(){ perl -e 'BEGIN{$D='\t';$f=shift;%cs=();} open(IN,"<",$f); while(<IN>){$c=0; map{ $s=length;$cs{$c}=($s>$cs{$c})?$s:$cs{$c};$c++;}split /$D/;}END{$cs{0}++;$x=join ",",map{($_>0)?($cs{$_}=$cs{$_}+$cs{$_-1}+1):$cs{$_}; $cs{$_}} sort{$a<=>$b}keys %cs;system("less -S -x$x $f");}' $1; }
export -f aless
HISTDIR="$HOME/.bash_histories/`uname -n`"
[[ ! -d $HISTDIR ]] && mkdir -p "$HISTDIR"
HISTFILE="$HISTDIR/$(date +%Y_%m)"
# Suppress duplicates, any two-letter commands..
HISTIGNORE="&:??:exit"
# Dupes
HISTCONTROL='erasedups'
# https://twitter.com/mjdominus/status/574937856298369024
# What is the biggest five digit number ABCDE that is divisible by BCDE, CDE, DE and E?
use strict;
for (my $i = 99999; $i>9999; $i--){
map {
my $div = join '', (split '', $i)[$_ .. 4];
next if ($div == 0 ) || ( $i % $div );
} 1 .. 4;
print "$i\n";
exit;
@keck
keck / gist:9940790
Created April 2, 2014 19:00
brew install of clamav no worky
$ brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 6fb4f02ad454675dbde0969a940d4f4e320ad1b2
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit haswell
OS X: 10.9.2-x86_64
Xcode: 5.1
CLT: 5.1.0.0.1.1393561416