iOS 7 comes with a new API called iBeacons. In short it allows device to check how far it is from a beacon. Under the hood it uses Bluetooth 4.0 LE. It’s available in iPhone 4S and newer, iPad3 and newer (including iPad Mini). Almost anything can be a beacon as long as it supports Bluetooth 4.0 LE: phone, dedicated device and laptop.

To give an example of what you could use iBeacons for, think of a group of museums managed by a single company. Each room in each of the museums would have an iBeacon transmitter placed in them. Each beacon is configured with settings or what Apple refers to as an identity. If you are running an app provided by the museum, each time you enter the museum you will be presented with information which changes depending on what room you are in. – source

Tutorials

Details

Limitations

Solution sounds exciting, but it has some limitations. Basically you need to know what you’re searching for:

Projects

A couple of useful projects from github:

  • iOS, HiBeacons @github.com – A very nice iBeacons demo app.
  • Mac as iBeacon @github.com – A tiny app to turn a Bluetooth LE-equipped Mac into an iBeacon.
  • iBeaconScanner @github.com – Mac Application to scan for nearby iBeacons regardless of their UUID.

Jokes on stackoverflow

Humours projects:

  • Ikea or Death - “[…] names of the furniture in IKEA sound a lot like the names of black metal bands”
  • Jargon generator - Hollywood-grade technical jargon

TShark is a network protocol analyzer. It lets you capture packet data from a live network, or read packets from a previously saved capture file, either printing a decoded form of those packets to the standard output or writing the packets to a file.

TL;DR; using TShark to monitor WiFi traffic and list MAC addresses around you:

$ tshark -a duration:16 -I -i en1 -Tfields -e wlan.sa 2>/dev/null | sort -u

Installing TShark (OSX)

  • Download and install Wireshark package from wireshark.org.
  • Installer will create various symlinks in /usr/local/bin.

Monitoring

First, let’s check what kind of interfaces we can use (this is what I get):

$ tshark -D     
1. en0 (Ethernet)
2. fw0 (FireWire)
3. bridge0 (Thunderbolt Bridge)
4. en1 (Wi-Fi)
5. p2p0
6. en4 (Thunderbolt 1)
7. lo0 (Loopback)

Basic usage:

$ tshark -i en1

This will keep on printing data to STDOUT. Stop it with ctrl + c. You’ll get even more data if you add -I (capture in monitor mode) parameter:

$ tshark -I -i en1

In monitor mode WiFi icon will change from:

Captured traffic viewed in Safari

to:

Captured traffic viewed in Safari

TShark produces huge amounts of data. We can use different output format to make it more readable (-T pdml) and and capture only 10 packets (-c 10):

$ tshark -I -i en1 -T pdml -c 10 > captured.xml                                                  
Capturing on 'Wi-Fi'
10 
$ cp /Applications/Wireshark.app/Contents/Resources/share/wireshark/pdml2html.xsl . 
$ open -a Safari captured.xml 

This will open Safari with human readable version of captured.xml:

Captured traffic viewed in Safari

But we can do much more in the command line, for example scan network for 16 seconds and print all spotted WiFi MAC addresses:

$ tshark -a duration:16 -I -i en1 -Tfields -e wlan.sa 2>/dev/null | sort -u

You can paste them into OUI Lookup Tool to do a reverse lookup of manufactures. List of all available fields listed in the wireshark documentation.

Alternatively you might do it in command line as well:

$ tshark -a duration:16 -I -i en1 -o column.format:'"","%rhs"' 2>/dev/null | sort -u

If you’re curious about additional parameters, here’s the explanation from explainshell.com. You might also like to check: column formats.

According to wikipedia:

In computing, a quine is a computer program which produces a copy of its own source code as its only output. … Quines are named after philosopher Willard Van Orman Quine (1908–2000), who made an extensive study of indirect self-reference. He coined, among others, the following paradox-producing expression, known as Quine’s paradox. “Yields falsehood when preceded by its quotation” yields falsehood when preceded by its quotation.

Coming up with simple quine in python is not hard…

s="s=%s;print s%%`s`";print s%`s`

There is also alternative approach. The output is program’s source code, this is not really allowed but loading its source code works like a charm…

import sys; print "".join(open(sys.argv[0]).readlines())

For some more self-reproducing programs have a look at: self_pyth.txt.

Have you heard about the Benford’s law? Apparently you can predict the first digit when number of statistical data is provided (any kind).

A phenomenological law also called the first digit law, first digit phenomenon, or leading digit phenomenon. Benford’s law states that in listings, tables of statistics, etc., the digit 1 tends to occur with probability ~30%, much greater than the expected 11.1% (i.e., one digit out of 9).

This inspired me to check whether that is also applicable when using files’ sizes as statistical data. I must admit that I’m pretty surprised by the results. Just have a look at the output:

Total samples: 23352
Start directory: /usr
Total time: 2.66 seconds
Digit	Result	Benford	Difference
1	0.3219	0.3010	-0.0209
2	0.1688	0.1761	+0.0073
3	0.1197	0.1249	+0.0052
4	0.0948	0.0969	+0.0021
5	0.0708	0.0792	+0.0084
6	0.0625	0.0669	+0.0045
7	0.0561	0.0580	+0.0019
8	0.0632	0.0512	-0.0121
9	0.0421	0.0458	+0.0036

You can try benford.py script yourself, for example:

$ python benford.py /usr