Check These Out
kills all wine running apps and processes.
Make a hotkey for it when running wine games in fullscreen and it locks. This is a great way to escape from it.
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
Using the 'time' command, running this with 'tr' took 28 seconds (and change) each time but using base64 only took 8 seconds (and change). If the file doesn't have to be viewable, pulling straight from urandom with head only took 6 seconds (and change)
Catches .swp, .swo, .swn, etc.
If you have access to lsof, it'll give you more compressed output and show you the associated terminals (e.g., pts/5, which you could then use 'w' to figure out where it's originating from): lsof | grep '\.sw.$'
If you have swp files turned off, you can do something like: ps x | grep '[g,v]im', but it won't tell you about files open in buffers, via :e [file].
Replace 'csv_file.csv' with your filename.
I wanted an easy way to list out the sizes of directories and all of the contents of those directories recursively.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Quick and dirty command that counts how many words can be typed just using the home row on the Dvorak Simplified Keyboard layout from a dictionary file, in this case /usr/share/dict/words.
According to the regular expression supplied, each word must contain all the keys on the Dvorak home row, and no other characters. For comparison, I've shown how many words are installed in my dictionary, how many can be typed with just the Dvorak home row and how many can be typed with just the QWERTY home row in the sample output. Nearly 10 times the amount.
If you want to see the words, remove the -c switch, and each word will be printed out.
$python -c "DEV = '/dev/input/event4'
#if event0 doesn't work, try event1 event2 etc
fo = open(DEV)
def interpret(keycode,state):
if state == 0:
print '%i up'%keycode
if state == 1:
print '%i down'%keycode
if state == 2:
print '%i repeat'%keycode
while 1:
line = fo.read(16)
if ord(line[10]) != 0:
keycode,state = line[10],line[12]
interpret(ord(keycode),ord(state))
"