This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# yoga-auto-rotate -- ghetto-style tablet mode, with keyboard and all. | |
# | |
# Simple little script that will detect an orientation change for a | |
# Lenovo Yoga 13 (very hackily) and adjust the active display's | |
# orientation and disable/enable the touchpad as necessary. | |
# | |
# The Yoga 13 will emit keycode `e03e` at one second intervals | |
# when the screen is flipped into tablet mode. Since this keycode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Caesar cipher encoding | |
echo "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" | tr '[A-Z]' '[X-ZA-W]' | |
# output: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD | |
# Caesar cipher decoding | |
echo "QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD" | tr '[X-ZA-W]' '[A-Z]' | |
# output: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG | |
# Can also be adjusted to ROT13 instead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encode | |
tr 'A-Za-z' 'N-ZA-Mn-za-m' <<<"The Quick Brown Fox Jumps Over The Lazy Dog" | |
# decode | |
echo "Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt" | tr '[A-Za-z]' '[N-ZA-Mn-za-m]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Open a connection to canternet | |
exec 3<>/dev/tcp/irc.canternet.org/6667; | |
# Login and join the channel. | |
printf "NICK BashBot\r\n" >&3; | |
printf "USER bashbot 8 * :IRC Bot in Bash\r\n" >&3; | |
sleep 2; | |
printf "JOIN #HackingIsMagic\r\n" >&3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HANDY ONE-LINE SCRIPTS FOR AWK 30 April 2008 | |
Compiled by Eric Pement - eric [at] pement.org version 0.27 | |
Latest version of this file (in English) is usually at: | |
http://www.pement.org/awk/awk1line.txt | |
This file will also be available in other languages: | |
Chinese - http://ximix.org/translation/awk1line_zh-CN.txt | |
USAGE: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# found on <http://files.majorsilence.com/rubbish/pygtk-book/pygtk-notebook-html/pygtk-notebook-latest.html#SECTION00430000000000000000> | |
# simple example of a tray icon application using PyGTK | |
import gtk | |
def message(data=None): | |
"Function to display messages to the user." | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import pygame.camera | |
from pygame.locals import * | |
DEVICE = '/dev/video0' | |
SIZE = (640, 480) | |
FILENAME = 'capture.png' | |
def camstream(): | |
pygame.init() |