Skip to content

Instantly share code, notes, and snippets.

@mponizil
Created January 28, 2014 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mponizil/8674125 to your computer and use it in GitHub Desktop.
Save mponizil/8674125 to your computer and use it in GitHub Desktop.
copy internal ip
#!/usr/bin/env coffee
os = require 'os'
nis = os.networkInterfaces().en0
for ni in nis
if ni.family is 'IPv4'
address = ni.address
copy = require('child_process').spawn('pbcopy')
copy.stdin.write(address)
copy.stdin.end()
process.stdout.write("copied to clipboard: #{address}\n")
process.exit()
process.stdout.write('no dice\n')
process.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment