commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
When the wireless card is in AP mode, list the users which are connected to the network.
This command will disconnect the user whose mac was specified from the current list of clients from the wireless network when the network card is working in access point mode. Works on atheros-based access points which use the madwifi driver (not sure, but don't think it will work on access points which are not atheros-based, as it uses the atheros's iwpriv extensions).
It will not prevent the user from reconnecting to the network, but may force the user to roam to another AP, with stronger signal.
Instead of hard-coding in a check to scrape info from ifconfig based on a specific interface, do it in a more portable way.
This works really well if you switch between wired, wireless, bluetooth or even VPN connections. You can get your current IP in a script (since it'll be something like tun0 instead of eth0 or wlan1).
This uses a well known public ip address 220.127.116.11, but it doesn't actually connect to it, it just shows you the route it would take.
Values will depend on the driver and the hardware specifics, so you need to refer to your driver documentation for proper interpretation of those values.
Gets only when the state is connected.