Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# Author: Serg Kolo
# Date: Oct 3rd, 2016
# Description: Script for aligning the center of
# user's active window with the center of the monitor
# Tested on: Ubuntu 16.04
# Written for: http://askubuntu.com/q/832720/295286
from __future__ import print_function
import gi
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Serg Kolo,<1047481448@qq.com>
# Date: September 28, 2016
# Purpose: Monitoring script that shutsdown
# system if logout occurs or chrome exits
# Written for: http://askubuntu.com/q/828524/295286
from gi.repository import Gdk
import subprocess
output = subprocess.check_output(['xrandr']).decode().split('\n')
found = None
for item in output:
if ' connected' in item:
found = True
print(item.split()[0])
if found and item.startswith(' '):
print(item.split()[0])
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import subprocess
import time
import os
def run_cmd(cmdlist):
""" Reusable function for running external commands """
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Encode;
use Net::DBus;
use diagnostics;
sub dbus_sub
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: Serg Kolo , contact: 1047481448@qq.com
Date: August 9th, 2016
Purpose: Spawns a command depending on current
viewport, as defined in ~/.workspace_commands.json
Written for: http://askubuntu.com/q/56367/295286
Tested on: Ubuntu 16.04 LTS , Unity desktop
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: Sergiy Kolodyazhnyy
Date: August 2nd, 2016
Written for: http://askubuntu.com/q/806212/295286
Tested on Ubuntu 16.04 LTS
usage: xinput_monitor.py [-h] [-q] -d DEVICE
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: Sergiy Kolodyazhnyy
Date: August 2nd, 2016
Written for: http://askubuntu.com/q/806212/295286
Tested on Ubuntu 16.04 LTS
usage: dynamic_mouse_speed.py [-h] [-q] [-p POINTER] [-s SCROLL] [-v]
@SergKolo
SergKolo / link_windows.py
Last active March 31, 2024 04:23
A script that allows linking two windows together such that switching focus on one, brings up the other as well
@SergKolo
SergKolo / ip-indicator.py
Created August 1, 2016 20:53 — forked from nathan-osman/ip-indicator.py
IP Address AppIndicator
#!/usr/bin/env python2
import appindicator
import gtk
import urllib2
class IPIndicator(appindicator.Indicator):
"""
An indicator displaying public IP address.