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
# Sample Code using python-evdev tutorials to list properties of all devices. | |
from evdev import InputDevice, list_devices | |
from pprint import pprint #the pretty print modules | |
for dev in list_devices(): # scan all devices | |
device = InputDevice(dev) | |
pprint(('device: ', device,'-',device.name)) | |
cap = device.capabilities(verbose=True,absinfo=True) | |
pprint(('Device Capabilities:', cap)) |
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
Program Lesson7_Program1; | |
Uses Crt; | |
Procedure DrawLine; | |
{This procedure helps me to avoid the rewriting the for loops} | |
Var Counter : Integer; | |
{Procedure Code Start} | |
Begin | |
textcolor(green); |
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 | |
# | |
# rotate_desktop.sh | |
# | |
# Rotates modern Linux desktop screen and input devices to match. Handy for | |
# convertible notebooks. Call this script from panel launchers, keyboard | |
# shortcuts, or touch gesture bindings (xSwipe, touchegg, etc.). | |
# | |
# Using transformation matrix bits taken from: | |
# https://wiki.ubuntu.com/X/InputCoordinateTransformation |
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
class SetterNGetter(): | |
def __init__(self, *args, **kwargs): | |
self.my_age = kwargs['age'] | |
self.my_name = kwargs['name'] | |
@property | |
def my_age(self): | |
return self.my_age |
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 | |
#In case we want to work with args that may contain any character, one could think to separate args by null byte \0 | |
function test { | |
while IFS= read -r -d '' f;do echo "f= $f";done< <(echo "$@" |base64 -d) | |
} | |
arg1="some more" | |
arg2="text here" | |
args=$(echo -e "$arg1\0$arg2\0" |base64) | |
#We need base64 or xxd since bash removes null by default. Converting to base64 we preserve the null byte. |
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 | |
function asciirotby { | |
case $1 in | |
"+1" | "-25") tr 'a-zA-Z' 'b-za-aB-ZA-A';; #Rotates by +1 , go to next letter (a becomes b) or rotate -25 (25 letters back) | |
"+2" | "-24") tr 'a-zA-Z' 'c-za-bC-ZA-B';; #Rotates by +2 , go to next 2 letters (a becomes c) | |
"+3" | "-23") tr 'a-zA-Z' 'd-za-cD-ZA-C';; #Ceasar Cipher - rotate by 3 | |
"+4" | "-22") tr 'a-zA-Z' 'e-za-dE-ZA-D';; | |
"+5" | "-21") tr 'a-zA-Z' 'f-za-eF-ZA-E';; | |
"+6" | "-20") tr 'a-zA-Z' 'g-za-fG-ZA-F';; | |
"+7" | "-19") tr 'a-zA-Z' 'h-za-gH-ZA-G';; |