Check These Out
This command require mac os x.
I sometimes have large files of MAC addresses stored in a file, some databases need the information stored with the semicolon (makes for easier programming a device) others don't. I have a barcode to text file scanner which usually butchers MAC addresses so this was the fix> I initially did this in awk ;)
awk '{for(i=10;i>=2;i-=2)$0=substr($0,1,i)":"substr($0,i+1);print}' mac_address_list
Repeat command after every 2 secs
Xsane produces PDFs that are too large - particularly multipage PDFs. This command compresses them. If you do not use A4, remove the -sPAPERSIZE flag.
An old USB A/B cable is all you need to make your own Smart Home hardware!
Cut off and discard the B-portion of the USB cable. On the A side, connect the RED (+) and WHITE (D-) wires via a 1 kiloohm resistor.
$Picture:
http://imgur.com/dJGVlAU
Now plug the cable into a USB port on your Linux computer. Your hardware is ready!
Run the above command after changing variable mysms to your personal email-to-SMS gateway info as required by your cellular service provider.
The command uses the amazing usbmon tool (see link below) to detect the cable.
For the curious, to view the raw usbmon output, run this command: (Also see the sample output)
$usbmon -i usb0
How does it work? When the red and white wires are connected (via the 1 kiloohm resistor) the USB hardwere is tricked into thinking that a new USB device is trying to start up.
We then use the usbmon utility to capture the host USB events as it tries to talk to the cable.
The expect utility watches the usbmon stream and waits for the disconnect text "-2:128" before sending the SMS message.
Finally, the sendmail tool is used to email the SMS message to your smartphone via your cellular provider's SMS-to-email gateway.
As a result, when the electrical connection between the red and white wire is interrupted, or the USB cable is unplugged from your computer, you get an SMS notification of the disconnect event on your smartphone.
Could this be the cheapest smart home gadget ever? What are YOU going to sense with it?
Please let me know in the comments and please don't forget to click it up!
$
$Links:
$
http://www.linuxcertif.com/man/8/usbmon/
http://en.wikipedia.org/wiki/USB#Pinouts
http://imgur.com/dJGVlAU
Avoiding a for loop brought this time down to less than 3 seconds on my old machine. And just to be clear, 33554432 = 8192 * 4086.
This is a naive way of finding source code comments in source code files that use C-like comments: // and /*...*/
if you start a large dd and forgot about statistics, but you still wonder what the progress is this command in an OTHER terminal will show you the way.
NOTE: the watch command by itself will not output anything
NOTE: the kill command will not kill the process
This version compresses the data for transport.