Skip to content

Instantly share code, notes, and snippets.

@elinorbgr
elinorbgr / monitor_accel.py
Created September 13, 2019 20:19
Simple & basic script to monitor device orientation & rotate sway display accordingly
#!/usr/bin/env python
import math
import time
from subprocess import call
DEVICE_PATH = '/sys/bus/iio/devices/iio:device0'
POOL_PERIOD = 0.5
MONITOR_NAME = 'eDP-1'
extern crate mio;
use std::io::Read;
use mio::*;
use mio::tcp::{TcpListener, TcpStream};
use mio::buf::ByteBuf;
struct MyHandler {
listener: NonBlock<TcpListener>,
↪ cargo rustc --release -- -Z time-passes Thu May 28 20:53:16 CEST 2015
Compiling rustbook v0.3.0 (file:///home/levans/test/rustbook)
time: 0.010 parsing
time: 0.000 recursion limit
time: 0.002 configuration 1
time: 0.000 gated macro checking
time: 0.000 crate injection
time: 0.009 macro loading
time: 0.000 plugin loading
time: 0.000 plugin registration

Keybase proof

I hereby claim:

  • I am vberger on github.
  • I am levans (https://keybase.io/levans) on keybase.
  • I have a public key whose fingerprint is 38D5 B5E0 54D1 4B90 F6BF ED89 3638 519D DEAA D525

To claim this, I am signing this object: