Skip to content

Instantly share code, notes, and snippets.

View amishurov's full-sized avatar

Alexander Mishurov amishurov

View GitHub Profile
@amishurov
amishurov / hotplug_monitor.sh
Created October 31, 2016 19:17
hotplug second monitor
crude version of https://github.com/codingtony/udev-monitor-hotplug/blob/master/usr/local/bin/monitor-hotplug.sh
cat /usr/local/bin/hotplug_monitor.sh
#!/bin/bash
export XAUTHORITY=/home/USER/.Xauthority
export DISPLAY=:0.0
if [ $(cat /sys/class/drm/card0-VGA-1/status) == "connected" ]; then
/usr/bin/xrandr -d :0 --output VGA1 --right-of LVDS1 --auto
else
@amishurov
amishurov / run_gunicorn.py
Created October 16, 2016 16:48
start gunicorn from python
# -*- coding: utf-8 -*-
from gunicorn import util
from gunicorn.app.base import Application
class FixtureApplication(Application):
def __init__(self, options=None):
self.options = options
self.usage = None
@amishurov
amishurov / rkill.sh
Last active May 16, 2016 13:13
recusive kill children for PID
#!/usr/bin/env bash
# Kills all children for passed PID recursively
function recursive_kill {
children=`pgrep -P $1`
if [ -z "$children" ]; then
kill -9 $1 && echo 'finish $1'
else
for child in $children; do