Skip to content

Instantly share code, notes, and snippets.

View ianthekid's full-sized avatar

Ian Ray ianthekid

View GitHub Profile
@treyhunner
treyhunner / findpi
Created December 30, 2012 19:28
Script for finding Raspberry Pi computers on the network. The scripts searches for MAC addresses starting with `b8:27:eb:` (the Ethernet port on the Pi) and `80:1f:02` (Edimax wifi USB dongle).
#!/bin/sh
if which nmap > /dev/null ; then
echo "Running nmap as root\n"
IP_RANGE=$(ip addr | grep "inet " | awk '{ print $2}' | grep -v 127.0.0)
sudo nmap -sP $IP_RANGE | grep -B2 -i 'b8:27:eb\|80:1f:02'
else
if which arp-scan > /dev/null ; then
echo "Running arp-scan as root\n"
sudo arp-scan --interface=eth0 --localnet | grep 'b8:27:eb\|80:1f:02'
else
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}