~/

Bash your way to success with awk, curl, and …uhh gSheets?

Let’s say you have a huge (1k+) list of 301s that you need to test in a CSV called redirects.csv that’s formatted like this: original_url,new_url let’s grab that first column (with the orginal urls), and create a txt file with them awk -F"," '{print $1}' redirects.csv > urls-to-test.txt now let’s test ‘em with curl and dump out the response url and the response code to a new csv xargs -n1 -P 10 curl -o /dev/null –silent –head –write-out '%{url_effective},%{redirect_url},%{http_code}\n' < urls-to-test.
Read more →

Docker Machine with NFS Part 1

if, like me - you’re tired of waiting for responses from your containers running docker for mac, try swapping to docker-machine with nfs mounts! deps brew install docker brew install docker-machine brew install docker-machine-nfs brew install go chose 1 of these: A: running vmware fusion (even faster than virtualbox) brew cask install vmware-fusion go get -u github.com/machine-drivers/docker-machine-driver-vmware docker-machine create –driver=vmware default B: default with virtualbox brew cask install virtualbox docker-machine create default enabling NFS mounts (will write to /etc/exports) - can conflict with vagrant/other NFS mounts
Read more →

Promises, Promises (Scraping Data with async functions)

I had to scrape a bunch of routing rules from a client’s default routing rules in Google Admin bc there’s no-way to export this list [accoridng to Google support] Bad news: there’s no JSON api here to scrape/hack/curl Worse news: Google’s CSRF policy is pretty damn hard to get around - so I had to write this little scrapper in vanilla JS with some promises to handle all the states
Read more →

Chrome and .height

Read more →

PHP7.2 Object Return Type Declarations

As of PHP 7.2 we can finally return type declarations for the object data type. (I know that reads funny, but it’s a true statement!) Here is an example: class MyClass { public $var = 'Hello World'; } $myclass = new MyClass; function getTestType(MyClass $arg) : object { return $arg; } echo getTestType($myclass)->var; Previous PHP versions would shit their pants over this with a fatal error: Fatal error: Uncaught TypeError: Return value of test() must be an instance of object, instance of MyClass returned in app/index.
Read more →