# Get local computer IP address for LAN network
alias myip="ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'"
# Public facing ip
alias myippub='wget -qO- icanhazip.com'
# Get mac address for en0
#!/bin/sh | |
case "$(uname -s)" in | |
Linux*) sys=Linux;; | |
Darwin*) sys=Mac;; | |
CYGWIN*) sys=Cygwin;; | |
MINGW*) sys=MinGw;; | |
*) sys="UNKNOWN:$(uname -s)" | |
esac | |
echo ${sys} |
#!/bin/sh | |
if [ -f "`find . -name .DS_Store`" ] ; then | |
if [ ! -f "`git rev-parse --is-inside-work-tree`" ] ; then | |
echo "no git repository found" | |
while true; do | |
read -p "Do you wish to initialize git repository in this folder $(echo $(pwd))?" yn | |
case $yn in |
params = {} | |
## Using string interpolation in where clauses is always dangerous | |
## BAD (Strings unescaped) | |
params[:firstname] = "'cat' OR lastname='Kelley'" | |
User.find(:first, conditions: "firstname = #{params[:firstname]}") | |
#=> AR Relation matching conditions | |
## GOOD (Escaped/Parameterized via Hash or Array) | |
User.find(:first, conditions: {firstname: params[:firstname]}) |
class ApplicationController < ActionController::Base | |
prepend_before_filter :authenticate_user! | |
private | |
## Tell client not to cache the response | |
def client_will_not_cache_response | |
response.headers["Cache-Control”] = “no-cache, no-store” | |
response.headers[“Pragma”] = “no-cache” | |
response.headers[“Expires”] = “Fri, 01 Jan 1990 00:00:00 GMT” | |
end |
class ApplicationController < ActionController::Base … | |
private | |
def client_will_not_cache_response | |
response.headers["Cache-Control”] = “no-cache, no-store” | |
response.headers[“Pragma”] = “no-cache” | |
response.headers[“Expires”] = “Fri, 01 Jan 1990 00:00:00 GMT” | |
end | |
end |
echo -e "\nScan LAN for other computers.\n" | |
if [ -n ""$@"" ]; then | |
ip=$(/sbin/ifconfig $1 | grep 'inet ' | awk '{ print $2}' | cut -d"." -f1,2,3 ) | |
nmap -sP $ip.1-255 | |
else | |
echo "Enter Interface parameter ex:" | |
echo -e "\t./scannetwork.sh $(ifconfig -lu | awk '{print $2}')\n" | |
echo "Available interfaces: " | |
for i in $(ifconfig -lu) |
if ! type "$brew" > /dev/null; then | |
echo "homebrew is not installed, please install homebrew" | |
else | |
if ! type "$curl" > /dev/null; then | |
echo "curl is not installed, please install homebrew" | |
else | |
if ! type "$jq" > /dev/null; then | |
echo "jq is not installed, please install homebrew" | |
else | |
if [ -z "$2" ]; then |
List the hosts on your LAN, their MAC addresses and IP's and then count them: | |
``` | |
$ arp -an | tee >(wc -l) | |
``` |
I recently relocated for new employment. I've been staying in an extended stay hotel for about 3 weeks now. The hotel I'm staying in gives its guests free Wifi access. However, it requires users to accept terms and conditions on a splash page via browser interface before they can use the network. This makes it difficult to use my Chromecast with the network, as it doesn't have a means of accessing that splash page. While I could call the IT help line, I decided to explore a work-around.
Like many networks, my hotel's network attempts to improve security by using MAC address filtering. Luckily, Mac OS X (10.4 - 10.10) makes it very easy to spoof your network card's MAC address.
Here's how to add a devices like Chromecast, AppleTV, Roku to a wireless network that requires a browser to authenticate and accept terms and conditions.