Skip to content

Instantly share code, notes, and snippets.

View gevasiliou's full-sized avatar

George Vasiliou gevasiliou

View GitHub Profile
@gevasiliou
gevasiliou / StatusIcon.py
Created September 29, 2016 13:17 — forked from pklaus/StatusIcon.py
StatusIcon – A Simple Tray Icon Application Using PyGTK
#!/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."
@gevasiliou
gevasiliou / listdev.py
Last active October 6, 2016 09:10
List System Devices with Python
# 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))
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);
@gevasiliou
gevasiliou / rotate_desktop.sh
Created October 14, 2016 09:35 — forked from mildmojo/rotate_desktop.sh
Script to rotate the screen and touch devices on modern Linux desktops. Great for convertible laptops.
#!/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
@gevasiliou
gevasiliou / yoga-auto-rotate
Created October 14, 2016 11:35 — forked from jrosco/yoga-auto-rotate
Lenovo Yoga 13 tablet mode / auto rotation script (ubuntu/debian)
#!/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
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
#!/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.
@gevasiliou
gevasiliou / rotatechars.sh
Created October 6, 2019 21:30
Encode / Decode Ascii Text by shifting chars
#!/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';;