ngrok: From any host to localhost

Ever need to give someone a URL to access a server running locally on your machine? Perhaps you had to forward ports or mess with some SSH reverse tunneling. Next time try ngrok!

There are a few ways to accomplish this, but ngrok is the most streamlined and feature packed way yet I've found to open up a local port to the world; perhaps for testing by a client or friend, or testing web hooks from services that can't access your internal network.

Here's how to get started:

ngrok 4567

You should see something like this:

Screenshot

And it's capable of so much more:

Require username/password

 ngrok -httpauth="helmet:12345" 80

Use specific subdomain

ngrok -subdomain=example 80

Forward to non-local services

ngrok 192.168.0.1:80

Forward traffic other than HTTP

ngrok -proto tcp 22

Inspect and replay traffic

open http://localhost:4040

Run your own server!

https://github.com/inconshreveable/ngrok/blob/master/docs/SELFHOSTING.md

Bonus: its written in go! So its fast and dependency free! Binaries are made available for Linux, Mac, and Windows.

In-Terminal Screenshots with iTerm2, Capybara, and Poltergeist

The latest builds of iTerm2 support an API for displaying images in the terminal. It can display any Base64-encoded PNG or JPEG image inline or as a download. Guess what, Poltergeist can render the current page as a... Base64-encoded PNG or JPEG! Let's combine the two with this little snippet of Ruby in our spec_helper.rb file:

def show_screenshot(width = 640)
  print "\033]1337;File=;inline=1;width=#{width}px:"
  print page.driver.render_base64
  print "\a\n"
end

Combine this with a call to Pry's binding.pry and now you can interact with your page and see the results of your capybara commands. Kind of like a web browser, but in your terminal!

Screenshot

The Changelog #100: Go programming with Rob Pike and Andrew Gerrand

http://5by5.tv/changelog/100

"Notes" posts are my free-form reactions to podcasts, books, movies, TV and other media. They may be a mixture of summaries and my own insights and thoughts.

  • Small, composable
  • Pragmatism / Minimalism
  • Designed by consensus of 3 people
  • Not "language designers" - but programmers
  • Splash Keynote Problems at Google with 10 million lines of C++ (http://talks.golang.org/2012/splash.article)
  • Started as systems langauge
  • Plan 9: Never caught on, ideas still relevant
  • Andrew: Go glob, community (HN), release binaries
  • Google imports OOS, not vice-versa - no GOOG branding anywhere
  • Go designed for lots of code, large environments
  • Right palette of tools for systems vs. python
  • Not all can be replaced with Go: LoC, latency (GC)
  • No Makefiles or metadata, don't need complex build system
  • In Google, used:
    • YouTube MySQL "proxy"/load balancer
    • dl.google.com (talks on talks.golang.org)
    • groupcache
  • contemporary stdlib solves modern problems (e.g., JSON)
  • Webserver in 10 LoC
  • Goal: Keep language in head, 50 pg. spec
  • Productive in a weekend
  • tour.golang.org
  • 1.2: Focus on more tools that understand go code)
    • December 1, 2013