This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |