Category Archives: Computer

Macro Buttons

A box with macro buttons for your PC using Arduino Leonardo

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#include <Keypad.h> // matrix read
#include <Keyboard.h> // keyboard out
#define ENABLE_PULLUPS // fuck the resistors
#define NUMBUTTONS 25 // matrix
#define NUMROWS 5 // matrix rows
#define NUMCOLS 5 // matrix cols
int analog1 = A3;
int analog2 = A7;
int inPinctrl = 3; // function ctrl, pull to vcc
int inPinalt = 4; // function alt, pull to vcc
int valctrl = 0; // variable to store shifter
int valalt = 0; // variable to store shifter
int joyx = 0;
int joyy = 0;
//define the symbols per key
char buttons[NUMROWS][NUMCOLS] = {
{'q','w','e','r','t'},
{'y','u','i','o','p'},
{'a','s','d','f','g'},
{'h','j','k','l','z'},
{'x','c','v','b','n'},
};
// q-1 (star) e-zoomin r-prev t-up
// y-2 u-clearstar o-open p-down
// a-3 (rate) d-zoomreset f-full g-left
// h-4 j-clearrate l-esc z-right
// x-5 c-slideshow v=zoomout b-next
// 14 16 10 9 8
// 21 q y a h x
// 20 w u s j c
// 19 e i d k v
// 18 t p g z n
// 15 r o f l b
byte rowPins[NUMROWS] = {16,20,19,18,15}; //connect to the row pinouts of the keypad
byte colPins[NUMCOLS] = {14,7,10,9,8}; //connect to the column pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad buttbx = Keypad( makeKeymap(buttons), rowPins, colPins, NUMROWS, NUMCOLS);
void setup() {
Serial.begin(115200); // debug out baud
pinMode(inPinctrl, INPUT); // sets the digital pin 3 as input
pinMode(inPinalt, INPUT); // sets the digital pin 4 as input
digitalWrite(inPinctrl, HIGH); // turn on pullup resistors
digitalWrite(inPinalt, HIGH); // turn on pullup resistors
Keyboard.begin(); // keyb starter
}
void loop() { // loop the program
CheckAllButtons(); // check tha buttons
}
void CheckAllButtons(void) {
joyx = analogRead(analog1);
joyy = analogRead(analog2);
Serial.println(joyx);
Serial.println(joyy);
if (joyx > 900) {
Keyboard.press(KEY_UP_ARROW);
delay(150);
Keyboard.releaseAll();
}
if (joyx < 200) {
Keyboard.press(KEY_DOWN_ARROW);
delay(150);
Keyboard.releaseAll();
}
if (joyy > 900) {
Keyboard.press(KEY_LEFT_ARROW);
delay(150);
Keyboard.releaseAll();
}
if (joyy < 200) {
Keyboard.press(KEY_RIGHT_ARROW);
delay(150);
Keyboard.releaseAll();
}
char key = buttbx.getKey();
if (key != NO_KEY) {
valctrl = digitalRead(inPinctrl); // read the function pin
valalt = digitalRead(inPinalt); // read the function pin
Serial.write(valctrl); // debug
Serial.println(); // enter
Serial.write(valalt); // debug
Serial.println(); // enter
Serial.write(key); // debug
Serial.println(); // enter
// button 1
if (key == 'q') {
if (valctrl == 0) { // function shifter active?
Keyboard.press(KEY_LEFT_CTRL);
}
if (valalt == 0) { // function shifter active?
Keyboard.press(KEY_LEFT_ALT);
}
Keyboard.press('1');
delay(150);
Keyboard.releaseAll();
}
// button 2
if (key == 'y') {
if (valctrl == 0) { // function shifter active?
Keyboard.press(KEY_LEFT_CTRL);
}
if (valalt == 0) { // function shifter active?
Keyboard.press(KEY_LEFT_ALT);
}
Keyboard.press('2');
delay(150);
Keyboard.releaseAll();
}
// button 3
if (key == 'a') {
if (valctrl == 0) { // function shifter active?
Keyboard.press(KEY_LEFT_CTRL);
}
if (valalt == 0) { // function shifter active?
Keyboard.press(KEY_LEFT_ALT);
}
Keyboard.press('3');
delay(150);
Keyboard.releaseAll();
}
// button 4
if (key == 'h') {
if (valctrl == 0) { // function shifter active?
Keyboard.press(KEY_LEFT_CTRL);
}
if (valalt == 0) { // function shifter active?
Keyboard.press(KEY_LEFT_ALT);
}
Keyboard.press('4');
delay(150);
Keyboard.releaseAll();
}
// button 5
if (key == 'x') {
if (valctrl == 0) { // function shifter active?
Keyboard.press(KEY_LEFT_CTRL);
}
if (valalt == 0) { // function shifter active?
Keyboard.press(KEY_LEFT_ALT);
}
Keyboard.press('5');
delay(150);
Keyboard.releaseAll();
}
// button i - clear rate
if (key == 'i') {
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press('0');
delay(150);
Keyboard.releaseAll();
}
// button k - clear label
if (key == 'k') {
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press('0');
delay(150);
Keyboard.releaseAll();
}
// button v - slideshow
if (key == 'v') {
Keyboard.press(KEY_ESC);
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press('s');
delay(150);
Keyboard.releaseAll();
}
// button t - zoomin
if (key == 't') {
Keyboard.press('+');
delay(150);
Keyboard.releaseAll();
}
// button g - zoomreset
if (key == 'g') {
Keyboard.press('*');
delay(150);
Keyboard.releaseAll();
}
// button n - zoomout
if (key == 'n') {
Keyboard.press('-');
delay(150);
Keyboard.releaseAll();
}
//r o f l b
// button r - prev
if (key == 'r') {
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ARROW);
delay(150);
Keyboard.releaseAll();
}
// button o - open
if (key == 'o') {
Keyboard.press(KEY_RETURN);
delay(150);
Keyboard.releaseAll();
}
// button f - full
if (key == 'f') {
Keyboard.press('f');
delay(150);
Keyboard.releaseAll();
}
// button l - esc
if (key == 'l') {
Keyboard.press(KEY_ESC);
delay(150);
Keyboard.releaseAll();
}
// button b - next
if (key == 'b') {
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_RIGHT_ARROW);
delay(150);
Keyboard.releaseAll();
}
}
}
#include <Keypad.h> // matrix read #include <Keyboard.h> // keyboard out #define ENABLE_PULLUPS // fuck the resistors #define NUMBUTTONS 25 // matrix #define NUMROWS 5 // matrix rows #define NUMCOLS 5 // matrix cols int analog1 = A3; int analog2 = A7; int inPinctrl = 3; // function ctrl, pull to vcc int inPinalt = 4; // function alt, pull to vcc int valctrl = 0; // variable to store shifter int valalt = 0; // variable to store shifter int joyx = 0; int joyy = 0; //define the symbols per key char buttons[NUMROWS][NUMCOLS] = { {'q','w','e','r','t'}, {'y','u','i','o','p'}, {'a','s','d','f','g'}, {'h','j','k','l','z'}, {'x','c','v','b','n'}, }; // q-1 (star) e-zoomin r-prev t-up // y-2 u-clearstar o-open p-down // a-3 (rate) d-zoomreset f-full g-left // h-4 j-clearrate l-esc z-right // x-5 c-slideshow v=zoomout b-next // 14 16 10 9 8 // 21 q y a h x // 20 w u s j c // 19 e i d k v // 18 t p g z n // 15 r o f l b byte rowPins[NUMROWS] = {16,20,19,18,15}; //connect to the row pinouts of the keypad byte colPins[NUMCOLS] = {14,7,10,9,8}; //connect to the column pinouts of the keypad //initialize an instance of class NewKeypad Keypad buttbx = Keypad( makeKeymap(buttons), rowPins, colPins, NUMROWS, NUMCOLS); void setup() { Serial.begin(115200); // debug out baud pinMode(inPinctrl, INPUT); // sets the digital pin 3 as input pinMode(inPinalt, INPUT); // sets the digital pin 4 as input digitalWrite(inPinctrl, HIGH); // turn on pullup resistors digitalWrite(inPinalt, HIGH); // turn on pullup resistors Keyboard.begin(); // keyb starter } void loop() { // loop the program CheckAllButtons(); // check tha buttons } void CheckAllButtons(void) { joyx = analogRead(analog1); joyy = analogRead(analog2); Serial.println(joyx); Serial.println(joyy); if (joyx > 900) { Keyboard.press(KEY_UP_ARROW); delay(150); Keyboard.releaseAll(); } if (joyx < 200) { Keyboard.press(KEY_DOWN_ARROW); delay(150); Keyboard.releaseAll(); } if (joyy > 900) { Keyboard.press(KEY_LEFT_ARROW); delay(150); Keyboard.releaseAll(); } if (joyy < 200) { Keyboard.press(KEY_RIGHT_ARROW); delay(150); Keyboard.releaseAll(); } char key = buttbx.getKey(); if (key != NO_KEY) { valctrl = digitalRead(inPinctrl); // read the function pin valalt = digitalRead(inPinalt); // read the function pin Serial.write(valctrl); // debug Serial.println(); // enter Serial.write(valalt); // debug Serial.println(); // enter Serial.write(key); // debug Serial.println(); // enter // button 1 if (key == 'q') { if (valctrl == 0) { // function shifter active? Keyboard.press(KEY_LEFT_CTRL); } if (valalt == 0) { // function shifter active? Keyboard.press(KEY_LEFT_ALT); } Keyboard.press('1'); delay(150); Keyboard.releaseAll(); } // button 2 if (key == 'y') { if (valctrl == 0) { // function shifter active? Keyboard.press(KEY_LEFT_CTRL); } if (valalt == 0) { // function shifter active? Keyboard.press(KEY_LEFT_ALT); } Keyboard.press('2'); delay(150); Keyboard.releaseAll(); } // button 3 if (key == 'a') { if (valctrl == 0) { // function shifter active? Keyboard.press(KEY_LEFT_CTRL); } if (valalt == 0) { // function shifter active? Keyboard.press(KEY_LEFT_ALT); } Keyboard.press('3'); delay(150); Keyboard.releaseAll(); } // button 4 if (key == 'h') { if (valctrl == 0) { // function shifter active? Keyboard.press(KEY_LEFT_CTRL); } if (valalt == 0) { // function shifter active? Keyboard.press(KEY_LEFT_ALT); } Keyboard.press('4'); delay(150); Keyboard.releaseAll(); } // button 5 if (key == 'x') { if (valctrl == 0) { // function shifter active? Keyboard.press(KEY_LEFT_CTRL); } if (valalt == 0) { // function shifter active? Keyboard.press(KEY_LEFT_ALT); } Keyboard.press('5'); delay(150); Keyboard.releaseAll(); } // button i - clear rate if (key == 'i') { Keyboard.press(KEY_LEFT_CTRL); Keyboard.press('0'); delay(150); Keyboard.releaseAll(); } // button k - clear label if (key == 'k') { Keyboard.press(KEY_LEFT_ALT); Keyboard.press('0'); delay(150); Keyboard.releaseAll(); } // button v - slideshow if (key == 'v') { Keyboard.press(KEY_ESC); Keyboard.press(KEY_LEFT_CTRL); Keyboard.press('s'); delay(150); Keyboard.releaseAll(); } // button t - zoomin if (key == 't') { Keyboard.press('+'); delay(150); Keyboard.releaseAll(); } // button g - zoomreset if (key == 'g') { Keyboard.press('*'); delay(150); Keyboard.releaseAll(); } // button n - zoomout if (key == 'n') { Keyboard.press('-'); delay(150); Keyboard.releaseAll(); } //r o f l b // button r - prev if (key == 'r') { Keyboard.press(KEY_LEFT_CTRL); Keyboard.press(KEY_LEFT_ARROW); delay(150); Keyboard.releaseAll(); } // button o - open if (key == 'o') { Keyboard.press(KEY_RETURN); delay(150); Keyboard.releaseAll(); } // button f - full if (key == 'f') { Keyboard.press('f'); delay(150); Keyboard.releaseAll(); } // button l - esc if (key == 'l') { Keyboard.press(KEY_ESC); delay(150); Keyboard.releaseAll(); } // button b - next if (key == 'b') { Keyboard.press(KEY_LEFT_CTRL); Keyboard.press(KEY_RIGHT_ARROW); delay(150); Keyboard.releaseAll(); } } }
#include <Keypad.h> // matrix read
#include <Keyboard.h> // keyboard out

#define ENABLE_PULLUPS // fuck the resistors
#define NUMBUTTONS 25 // matrix
#define NUMROWS 5 // matrix rows
#define NUMCOLS 5 // matrix cols

int analog1 = A3;
int analog2 = A7;


int inPinctrl = 3;  // function ctrl, pull to vcc
int inPinalt = 4;  // function alt, pull to vcc 
int valctrl = 0;    // variable to store shifter
int valalt = 0;    // variable to store shifter
int joyx = 0;
int joyy = 0;

//define the symbols per key
char buttons[NUMROWS][NUMCOLS] = {
  {'q','w','e','r','t'},
  {'y','u','i','o','p'},
  {'a','s','d','f','g'},
  {'h','j','k','l','z'},
  {'x','c','v','b','n'},
};
// q-1 (star)      e-zoomin    r-prev t-up
// y-2 u-clearstar             o-open p-down
// a-3 (rate)      d-zoomreset f-full g-left
// h-4 j-clearrate             l-esc  z-right
// x-5 c-slideshow v=zoomout   b-next

//    14 16 10 9  8 
// 21 q  y  a  h  x  
// 20 w  u  s  j  c
// 19 e  i  d  k  v 
// 18 t  p  g  z  n
// 15 r  o  f  l  b 

byte rowPins[NUMROWS] = {16,20,19,18,15}; //connect to the row pinouts of the keypad
byte colPins[NUMCOLS] = {14,7,10,9,8}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad buttbx = Keypad( makeKeymap(buttons), rowPins, colPins, NUMROWS, NUMCOLS); 


void setup() {

  Serial.begin(115200); // debug out baud
  pinMode(inPinctrl, INPUT);    // sets the digital pin 3 as input
  pinMode(inPinalt, INPUT);    // sets the digital pin 4 as input
  digitalWrite(inPinctrl, HIGH);       // turn on pullup resistors
  digitalWrite(inPinalt, HIGH);       // turn on pullup resistors
  Keyboard.begin();        // keyb starter
}



void loop() { // loop the program

  CheckAllButtons(); // check tha buttons

}


void CheckAllButtons(void) {
  joyx = analogRead(analog1);
  joyy = analogRead(analog2);
  Serial.println(joyx);
  Serial.println(joyy);
  if (joyx > 900) { 
      Keyboard.press(KEY_UP_ARROW);
      delay(150);
      Keyboard.releaseAll();
  }
  if (joyx < 200) { 
      Keyboard.press(KEY_DOWN_ARROW);
      delay(150);
      Keyboard.releaseAll();      
  }
  if (joyy > 900) { 
      Keyboard.press(KEY_LEFT_ARROW);
      delay(150);
      Keyboard.releaseAll();
  }
  if (joyy < 200) { 
      Keyboard.press(KEY_RIGHT_ARROW);
      delay(150);
      Keyboard.releaseAll();
  }

  
  char key = buttbx.getKey();

  if (key != NO_KEY)  {
      valctrl = digitalRead(inPinctrl);   // read the function pin
      valalt = digitalRead(inPinalt);   // read the function pin
      Serial.write(valctrl);  // debug
      Serial.println();  // enter
      Serial.write(valalt);  // debug
      Serial.println();  // enter
      Serial.write(key);  // debug
      Serial.println();  // enter
      // button 1 
          if (key == 'q') {
            if (valctrl == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_CTRL); 
            }
            if (valalt == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_ALT); 
            }
           Keyboard.press('1');
           delay(150);
           Keyboard.releaseAll();
          }
      // button 2
          if (key == 'y') {
            if (valctrl == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_CTRL); 
            }
            if (valalt == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_ALT); 
            }
           Keyboard.press('2');
           delay(150);
           Keyboard.releaseAll();
          }
      // button 3
          if (key == 'a') {
            if (valctrl == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_CTRL); 
            }
            if (valalt == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_ALT); 
            }
           Keyboard.press('3');
           delay(150);
           Keyboard.releaseAll();
          }
      // button 4
          if (key == 'h') {
            if (valctrl == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_CTRL); 
            }
            if (valalt == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_ALT); 
            }
           Keyboard.press('4');
           delay(150);
           Keyboard.releaseAll();
          }
      // button 5
          if (key == 'x') {
            if (valctrl == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_CTRL); 
            }
            if (valalt == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_ALT); 
            }
           Keyboard.press('5');
           delay(150);
           Keyboard.releaseAll();
          }
      // button i - clear rate
          if (key == 'i') {
           Keyboard.press(KEY_LEFT_CTRL); 
           Keyboard.press('0');
           delay(150);
           Keyboard.releaseAll();
          }
      // button k - clear label
          if (key == 'k') {
           Keyboard.press(KEY_LEFT_ALT); 
           Keyboard.press('0');
           delay(150);
           Keyboard.releaseAll();
          }
      // button v - slideshow
          if (key == 'v') {
           Keyboard.press(KEY_ESC); 
           Keyboard.press(KEY_LEFT_CTRL); 
           Keyboard.press('s');
           delay(150);
           Keyboard.releaseAll();
          }
      // button t - zoomin
          if (key == 't') {
           Keyboard.press('+'); 
           delay(150);
           Keyboard.releaseAll();
          }
      // button g - zoomreset
          if (key == 'g') {
           Keyboard.press('*');
           delay(150);
           Keyboard.releaseAll();
          }
      // button n - zoomout
          if (key == 'n') {
           Keyboard.press('-'); 
           delay(150);
           Keyboard.releaseAll();
          }
//r  o  f  l  b
      // button r - prev
          if (key == 'r') {
           Keyboard.press(KEY_LEFT_CTRL); 
           Keyboard.press(KEY_LEFT_ARROW); 
           delay(150);
           Keyboard.releaseAll();
          }
           
      // button o - open
          if (key == 'o') {
           Keyboard.press(KEY_RETURN); 
           delay(150);
           Keyboard.releaseAll();
          }
           
      // button f - full
          if (key == 'f') {
           Keyboard.press('f'); 
           delay(150);
           Keyboard.releaseAll();
          }
           
      // button l - esc
          if (key == 'l') {
           Keyboard.press(KEY_ESC); 
           delay(150);
           Keyboard.releaseAll();
          }
           
      // button b - next
          if (key == 'b') {
           Keyboard.press(KEY_LEFT_CTRL); 
           Keyboard.press(KEY_RIGHT_ARROW); 
           delay(150);
           Keyboard.releaseAll();
          }
           





          
  }
}

Pressure Lab

For measuring pressure in fermentation containers, I designed a pressure sensor which could be wireless connected to a fermentation container.
The sensor would transmit the values to a Raspberry which was configured as a Access Point and would store the measurements and generated graphs using Grafana.

Raspberry with RealtimeClock
RTC on raspberry

3D printed holder, designed in blender. Holds battery prints and has little handle to lift from container

Nodes config:

Esp configuration, connect with micro-usb
Flashing with linux

esptool.py -p /dev/ttyUSB0  write_flash 0x00000  ESP_Easy_mega-20190311_normal_ESP8266_4M.bin

Make a connection with the ESP Access point

Connect esp with a power source.
Look for a AP with ESP_Easy_0

Use password “configesp” to connect

Start you browser and enter http://192.168.4.1

In wifi wizard setup select “pressurespot”
Enter password “pressurespot”

Press connect

Wait 20s and look in the raspberry logs which IP the ESP got.

Connect laptop/mobile to wifi “pressurespot”and connect

Enter found IP from ESP in your browser.

Proceed to main config

Main setting table, set the following

  • Unit name & number + append
  • SSID and WPA key pressurespot
  • Client IP block level allow all
  • Press submit

Press controller tab

Press first edit button and set following
– Protocol: domoticz http
Next set
– Controller IP : 10.42.0.1
– Toggle enabled and press submit

Resulting in:

Next we got to Hardware

I2C interface switch GPIO-4 and GPIO-5

  • GPIO – SDA: GPIO-4 (D2) change to GPIO-5 (D1)
  • GPIO – SCL: GPIO-5 (D1) change to GPIO-4 (D2)
  • Press “Submit”

Devices TAB

Press edit, and select device “Environment – BMx280” from the pulldown menu.

Next, set the following

  • Name: pressure
  • Enable on
  • I2C address : 0x76 ( Is there is no 0x76 of 0x77 .. do a i2c scan on the next tab )
  • Send to controller , mark this
  • IDX: give this the number you had given this node (this is the one you have to use in domoticz )
  • interval 10Seconds
  • and press submit

In the Devices tab, you should be able to see the sensor with the values (Temperature and pressure)

No values? Do a i2c scan and/or reboot ESP ( You can find these in the tools tab)

Tools TAB

Press I2C scan, when seeing a address like 0x76 or 0x77 use this in previous tabs.
Still nothing, even after reboot? Maybe faulty hardware?

Everything okay? Back to the config tab

We are going to set the sleep mode.
Warning ! .. when setting this it is hard to get into the config pages again.
ESP will startup, connect to wifi, send values and goes to sleep again.

At the bottom set: Sleep awake time 1 sec

Buttons on the raspberry / pressurespot

Red button :

  • Less than 3 seconds is reboot
  • Longer than 3 seconds is shut down
    • Charger can be removed, when the green light is off

Led lights on the sensors

  • Red light (R2; constant): battery is charging
  • Blue light (R1; constant): battery is full
  • Blue light (R1; constant) & red light (R2; blinking): trying to charge, but no battery connected

Add shutdown script to /etc/rc.local

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
python /usr/local/bin/power-switch.py &amp;
python /usr/local/bin/power-switch.py &amp;
python /usr/local/bin/power-switch.py &amp;

/usr/local/bin/power-switch.py

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/usr/bin/python
import threading, subprocess
import RPi.GPIO as GPIO
def shutdown():
subprocess.call('sudo shutdown -h now', shell=True)
def edge_detected(pin):
if GPIO.input(pin):
t.cancel()
subprocess.call('sudo reboot', shell=True)
else:
t.start()
if __name__ == '__main__':
try:
GPIO.setmode(GPIO.BOARD)
GPIO.setup(5, GPIO.IN)
GPIO.add_event_detect(5, GPIO.BOTH, callback=edge_detected, bouncetime=10)
t = threading.Timer(3.0, shutdown)
while True:
pass
finally:
GPIO.cleanup()
#!/usr/bin/python import threading, subprocess import RPi.GPIO as GPIO def shutdown(): subprocess.call('sudo shutdown -h now', shell=True) def edge_detected(pin): if GPIO.input(pin): t.cancel() subprocess.call('sudo reboot', shell=True) else: t.start() if __name__ == '__main__': try: GPIO.setmode(GPIO.BOARD) GPIO.setup(5, GPIO.IN) GPIO.add_event_detect(5, GPIO.BOTH, callback=edge_detected, bouncetime=10) t = threading.Timer(3.0, shutdown) while True: pass finally: GPIO.cleanup()
#!/usr/bin/python
import threading, subprocess
import RPi.GPIO as GPIO
def shutdown():
    subprocess.call('sudo shutdown -h now', shell=True)
def edge_detected(pin):
    if GPIO.input(pin):
        t.cancel()
        subprocess.call('sudo reboot', shell=True)
    else:
        t.start()
if __name__ == '__main__':
    try:
        GPIO.setmode(GPIO.BOARD)
        GPIO.setup(5, GPIO.IN)
        GPIO.add_event_detect(5, GPIO.BOTH, callback=edge_detected, bouncetime=10)
        t = threading.Timer(3.0, shutdown)
        while True:
            pass
    finally:
        GPIO.cleanup()

/usr/local/bin/ledoff.py

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
GPIO.output(18,GPIO.LOW)
#!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(18,GPIO.OUT) GPIO.output(18,GPIO.LOW)
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
GPIO.output(18,GPIO.LOW)

/usr/local/bin/ledon.py

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
GPIO.output(18,GPIO.HIGH)
#!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(18,GPIO.OUT) GPIO.output(18,GPIO.HIGH)
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(18,GPIO.OUT)
GPIO.output(18,GPIO.HIGH)

nmcli device wifi hotspot ssid pressurespot password pressurespot

 /etc/NetworkManager/system-connections/Hotspot-1

[connection]
id=Hotspot-1
uuid=c2c05528-63f9-44c7-93ce-264187a45086
type=wifi
permissions=
timestamp=1553708934

[wifi]
hidden=true
mac-address=B8:27:EB:7F:D5:E7
mac-address-blacklist=
mode=ap
seen-bssids=B8:27:EB:7F:D5:E7;
ssid=pressurespot

[wifi-security]
group=ccmp;
key-mgmt=wpa-psk
pairwise=ccmp;
proto=rsn;
psk=pressurespot

[ipv4]
dns-search=
method=shared

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=ignore

/usr/bin/servicecheck.sh (in rc.local and crontab root user – every minute

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/bin/bash
nmcli connection show | grep "Hotspot-1 c2c05528-63f9-44c7-93ce-264187a45086 802-11-wireless wlan0" &gt;/dev/null &amp;&amp; touch /tmp/wlan || rm -f /tmp/wlan
for f in influx domoticz telegraf grafana mosquitto ; do
pgrep $f &gt;/dev/null &amp;&amp; touch /tmp/$f || rm -f /tmp/$f
done
count=$(ls /tmp/influx /tmp/domoticz /tmp/telegraf /tmp/grafana /tmp/mosquitto /tmp/wlan | wc -l)
if [ $count -eq 6 ] ; then
/usr/local/bin/ledon.py
exit 0
fi
for timer in {1..10} ; do
/usr/local/bin/ledon.py
sleep 1
/usr/local/bin/ledoff.py
sleep 1
done
#!/bin/bash nmcli connection show | grep "Hotspot-1 c2c05528-63f9-44c7-93ce-264187a45086 802-11-wireless wlan0" &gt;/dev/null &amp;&amp; touch /tmp/wlan || rm -f /tmp/wlan for f in influx domoticz telegraf grafana mosquitto ; do pgrep $f &gt;/dev/null &amp;&amp; touch /tmp/$f || rm -f /tmp/$f done count=$(ls /tmp/influx /tmp/domoticz /tmp/telegraf /tmp/grafana /tmp/mosquitto /tmp/wlan | wc -l) if [ $count -eq 6 ] ; then /usr/local/bin/ledon.py exit 0 fi for timer in {1..10} ; do /usr/local/bin/ledon.py sleep 1 /usr/local/bin/ledoff.py sleep 1 done
#!/bin/bash
nmcli connection show  | grep "Hotspot-1           c2c05528-63f9-44c7-93ce-264187a45086  802-11-wireless  wlan0" &gt;/dev/null &amp;&amp; touch /tmp/wlan || rm -f /tmp/wlan
for f in influx domoticz telegraf grafana mosquitto ; do
pgrep $f &gt;/dev/null &amp;&amp; touch /tmp/$f || rm -f /tmp/$f
done
count=$(ls  /tmp/influx /tmp/domoticz /tmp/telegraf /tmp/grafana /tmp/mosquitto /tmp/wlan | wc -l)
if [ $count -eq 6 ]  ; then
/usr/local/bin/ledon.py
exit 0
fi

for timer in {1..10} ; do
/usr/local/bin/ledon.py
sleep 1

/usr/local/bin/ledoff.py
sleep 1
done

Rest services to be installed on Raspberry

At the moment the raspberry uses domoticz between the Mqtt broker (Mosquitto) and the database (Influx)
Data wil be displayed using grafana.

tail -f /var/log/syslog shows which ip to which ESP
DHCPACK(wlan0) 10.42.0.104 cc:50:e3:c4:96:61 lab-
DHCPACK(wlan0) 10.42.0.181 cc:50:e3:c4:8d:73 lab-4
DHCPACK(wlan0) 10.42.0.186 cc:50:e3:c4:9b:ef lab-1

Configuring the raspberry

Install influx and grafana

First we add Influx repositories to apt:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
echo "deb https://repos.influxdata.com/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add - source /etc/os-release echo "deb https://repos.influxdata.com/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
echo "deb https://repos.influxdata.com/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

Update apt with the new repo & install.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo apt update && sudo apt install -y influxdb
sudo apt update && sudo apt install -y influxdb
sudo apt update && sudo apt install -y influxdb

Then start the influxdb service and set it to run at boot:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo systemctl enable influxdb --now
sudo systemctl enable influxdb --now
sudo systemctl enable influxdb --now

Again we need to add the Grafana packages to apt:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list

We can now update and install the binaries:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo apt update && sudo apt install -y grafana
sudo apt update && sudo apt install -y grafana
sudo apt update && sudo apt install -y grafana

Then simply enable the service and set to run at boot:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo systemctl enable grafana-server.service --now
sudo systemctl enable grafana-server.service --now
sudo systemctl enable grafana-server.service --now

Now we can check that grafana is up by loading it in a browser: http://10.42.0.1:3000. If so, you can log in with the username and password = admin and set a new admin password.

Install mosquitto

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo apt install mosquitto mosquitto-clients
sudo apt install mosquitto mosquitto-clients
sudo apt install mosquitto mosquitto-clients

Install domoticz using below command

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><strong>curl -sSL install.domoticz.com | sudo bash</strong></code>
<code><strong>curl -sSL install.domoticz.com | sudo bash</strong></code>
<code><strong>curl -sSL install.domoticz.com | sudo bash</strong></code>

Under hardware add MQTT server adress 127.0.0.1

Add virtual sensors to domoticz.

Click hardware and create virtual sensor, lab with sensornumber. Sensor type is Temp+Baro.

When looking at devices you will see the virtual devices.

Here you can see if data is coming from the ESP’s

Pushing the data into Influxdb:

Goto settings > more options > data push > influxdb

Add temperature

  • Device name: lab* (lab plus unit number)
  • Value to send: temperature
  • Target type: direct (NOTE screenshot below is wrong)
  • press add

Add barometer

  • Device name: lab* (lab plus unit number)
  • Value to send: Barometer
  • Target type: direct (NOTE screenshot below is wrong)
  • press add

Configure Grafana

Go with your browser to http://10.42.0.1 when connected to the rpi access point

Goto settings and data sources, add influxdb with source http://localhost:8086
Goto dashboard and create a new one.

Data source is influx, select A Barometer
And the IDX that was used in configuring the ESP
Axes: Units in millibars, above example had temperature, for both Baro and Temp in one graph.
Select null value as connected

TODO

Telegraf/mosquito
Services in domoticz
Rpi status display
Sensor test / monitor

Little USB password paster

When using Spice and VNC to virtual machine consoles, and remote consoles like idrac and ilo, it is not alway possible to copy-paste.

When doing maintenance it is a annoyance to type a super strong and long password by hand, Prone to typing errors, timeouts. And following lockouts.

So i wanted to auto type the password.

First solution was to bind a little bash script to a key combination.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/bin/bash
# Usage: make a keypress shortcut to this script
# activate shortcut, and the script wil give you 10 seconds to click and focus remote console window.
# It pastes the password, and you can press enter to login
# ( you can use xdotool also to press enter for you )
sleep 10
xdotool type "SUP3Rl00000ngandcompl3xpasswo0d@#@#@#%$%$%%$-you-cant-type-me-without-erors"
#!/bin/bash # Usage: make a keypress shortcut to this script # activate shortcut, and the script wil give you 10 seconds to click and focus remote console window. # It pastes the password, and you can press enter to login # ( you can use xdotool also to press enter for you ) sleep 10 xdotool type "SUP3Rl00000ngandcompl3xpasswo0d@#@#@#%$%$%%$-you-cant-type-me-without-erors"
#!/bin/bash
# Usage: make a keypress shortcut to this script
# activate shortcut, and the script wil give you 10 seconds to click and focus remote console window.
# It pastes the password, and you can press enter to login
# ( you can use xdotool also to press enter for you )
sleep 10
xdotool type "SUP3Rl00000ngandcompl3xpasswo0d@#@#@#%$%$%%$-you-cant-type-me-without-erors"

I’ve bound this to a key combination on my workstation.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name 'passpaste'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command '~/bin/passpaste.sh'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding '<Super>p'
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']" gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name 'passpaste' gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command '~/bin/passpaste.sh' gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding '<Super>p'
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name 'passpaste'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command '~/bin/passpaste.sh'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding '<Super>p'

This works, but only where this script is installed.
So not on colleagues machines, workstations with windows, and the super secret admin/root account sits in a file.

So i made a password key, which count be behind lock and key.

Using a digistump, a push-button and a resistor, the passpaster was born.

Program to flash on the digistump

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#include "DigiKeyboard.h"
void setup() {
DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.delay(1000);
}
void loop() {
if (digitalRead(0) == HIGH) WorkPass();
if (digitalRead(1) == HIGH) LtPass();
}
void WorkPass() {
DigiKeyboard.print("SUP3Rl00000ngandcompl3xpasswo0d@#@#@#%$%$%%$-you-cant-type-me-without-erors");
DigiKeyboard.println();
DigiKeyboard.delay(50);
setup();
}
void LtPass() {
DigiKeyboard.print("secondlongpasswordifyouareusingtwobuttons");
DigiKeyboard.println();
DigiKeyboard.delay(50);
setup();
}
#include "DigiKeyboard.h" void setup() { DigiKeyboard.sendKeyStroke(0); DigiKeyboard.delay(1000); } void loop() { if (digitalRead(0) == HIGH) WorkPass(); if (digitalRead(1) == HIGH) LtPass(); } void WorkPass() { DigiKeyboard.print("SUP3Rl00000ngandcompl3xpasswo0d@#@#@#%$%$%%$-you-cant-type-me-without-erors"); DigiKeyboard.println(); DigiKeyboard.delay(50); setup(); } void LtPass() { DigiKeyboard.print("secondlongpasswordifyouareusingtwobuttons"); DigiKeyboard.println(); DigiKeyboard.delay(50); setup(); }
#include "DigiKeyboard.h"
void setup() {
  DigiKeyboard.sendKeyStroke(0);
  DigiKeyboard.delay(1000);
}

void loop() {
  if (digitalRead(0) == HIGH) WorkPass();
  if (digitalRead(1) == HIGH) LtPass();
}

void WorkPass() {
  DigiKeyboard.print("SUP3Rl00000ngandcompl3xpasswo0d@#@#@#%$%$%%$-you-cant-type-me-without-erors");
  DigiKeyboard.println();
  DigiKeyboard.delay(50);
  setup();
}

void LtPass() {
  DigiKeyboard.print("secondlongpasswordifyouareusingtwobuttons");
  DigiKeyboard.println();
  DigiKeyboard.delay(50);
  setup();
}

Plug the Digispark into you machine, it wil emulate a HID device (Keyboard).
Get your remote console into focus, press button .. presto!

TODO:

  • 3D print a little case
  • pin protect?
  • rotary + display? (Like below)

It would be nice to have something like:

Rotary encoder 1 – selects which password to paste
Rotary encoder 2 – (1-255) does a encryption method on the password
Display shows : Password #32 – Crypt # 88
So you can have for example 255 passwords with 255 encryptions .. which to use when? Only you know.

Above can’t be done with a Digispark, so i’ll have to use a Arduino Pro Mini or a equivalent

Fixing a WD My passport not working in New Zealand

I’ve got a backup disk for my photos.
You can connect it via USB and has a SDCard slot for your camera SDCards.
You can also connect to is using it as a Wifi Access Point.
(You can even install twonky!)

The cardreader should automatically copy a inserted card to its internal harddrive.
I’ve tested this at home, but here in New Zealand it woudn’t work.

So i started investigating.
(I was in the middle of nowhere, so I could not search for answers.)

I’ve got the juice ssh client on my phone.
Connecting to the AP will give you a IP, but whats the IP from de WD?
Just use JuiceSSH to make a local connection (to your android) first.
And type: ip neigh
This will give you the ip from neighbouring devices, thats only one .. the WD.

Connect to the WD with ssh using root@IPNUMMER (password should be same as you configured the device with)

Looking at the logs gave me some idea where the problem was.

It would not mount the sdcard! Why, that one is working.
(In de Nikon Camera and using a cardreader with OTG on my android)

I first wrote my own mounter and copy program. That worked, so i could at least backup my photos.
Now I could search for the problem.

My backup script named “script”

mkdir /tmp/fash ; mount /dev/mmcblk0p1 /tmp/fash mounts okay!

The sdmount.sh has a problem, it uses the timezone in its script.
This will work when in GMT+12 -> GMT-12.
But we are in NZ .. thats GMT+13

Removing some checks in above script (sdmount.sh)
(Adding timeoffset_min=8)
Made the script work for me again.
When I got home from our trip, I flashed a new firmware version on the device, which corrected the problem.

Password generator dutch

Generates easy to remember passwords, using 3 words and a number

EXAMPLES:
TotaalHeuvelSorry25
ZorgenEnkeleDubbel42
TweedeMaalCadeau18
BlauwMamaZeep99
NetFoutFles88
KeusZijDaar18
AanbodVuurKaart98
ReddenGelijkHaan68
WakkerLatenHaten47

Words in list below are generated on lenght and SFW.
For getting a list of words a certain lenght use:

# Words between 4 and 7 characters
grep -o -w '\w\{4,7\}' /usr/share/dict/dutch
# Didn't use wordlist above due to many not easyly to remember words.
#!/bin/bash
me=`basename "$0"`
cat $me | sed '1,/^WOORDEN$/d' | shuf | head -3 | while read ; do echo -n $REPLY ;done ; echo $(shuf -i 10-99 -n 1)
exit 0
WOORDEN
Aan
Aanbod
Aanval
Aap
Aarde
Aardig
Acht
Achter
Actief
Ademen
Afname
Afval
Alleen
Alles
Als
Altijd
Ander
Andere
Anders
Angst
Appel
Arm
Auto
Avond
Baan
Baby
Bad
Bal
Bang
Bank
Basis
Bed
Been
Beer
Beest
Beetje
Begin
Begrip
Beide
Beker
Bel
Bellen
Berg
Beroep
Best
Beter
Bezoek
Bieden
Bij
Bijna
Bijten
Binnen
Blad
Blauw
Blazen
Blij
Bloed
Bloem
Bodem
Boek
Boete
Boom
Boon
Boord
Boos
Bord
Bos
Bot
Bouwen
Boven
Breed
Breken
Brief
Broer
Broek
Brood
Brug
Bruin
Bui
Buiten
Bureau
Buren
Bus
Cadeau
Cirkel
Cool
Daar
Daarom
Dag
Dak
Dan
Dansen
Dapper
Dat
Deel
Deken
Deksel
Delen
Derde
Deze
Dienen
Diep
Dier
Dik
Ding
Dit
Doen
Dom
Donker
Dood
Door
Doos
Dorp
Draad
Dragen
Drie
Drogen
Dromen
Droog
Druk
Dubbel
Dun
Dus
Duur
Duwen
Echt
Een
Één
Eend
Eerste
Eeuw
Effect
Eigen
Eiland
Einde
Eis
Elk
Enkele
Erg
Eten
Even
Examen
Falen
Feest
Feit
Fel
Fijn
Film
Fit
Fles
Foto
Fout
Fris
Fruit
Gaan
Gat
Gebied
Gedrag
Geel
Geen
Geit
Geld
Gelijk
Geloof
Geluid
Geluk
Gemak
Gemeen
Genoeg
Genot
Geur
Gevaar
Geven
Gevolg
Gewoon
Gezond
Gif
Glad
Glas
God
Goed
Goud
Graf
Grap
Gras
Grens
Grijs
Groen
Groep
Grof
Grond
Groot
Haan
Haar
Haast
Hal
Halen
Half
Hallo
Hamer
Hand
Hard
Hart
Haten
Hebben
Heel
Heet
Helder
Helft
Help
Hem
Hemel
Hen
Herfst
Hert
Het
Heuvel
Hier
Hij
Hobby
Hoe
Hoed
Hoek
Hoewel
Hond
Honger
Hoofd
Hoog
Hoogte
Hoop
Horen
Hotel
Houden
Huilen
Huis
Hun
Huren
Hut
Huur
Idee
Ieder
Iemand
Iets
Ijs
Ijzer
Jaar
Jagen
Jas
Jij
Jong
Jongen
Jouw
Jullie
Kaars
Kaart
Kaas
Kamer
Kans
Kant
Kap
Kast
Kat
Kennen
Kennis
Keuken
Keus
Kiezen
Kijken
Kind
Kip
Kist
Klaar
Klas
Klasse
Kleden
Klein
Kleren
Kleur
Klok
Klopt
Knie
Koers
Koffer
Koffie
Kok
Koken
Kom
Komen
Koning
Koorts
Kop
Kopen
Kort
Kost
Kosten
Koud
Kraam
Kracht
Krant
Kruis
Kuil
Kunnen
Kunst
Laag
Laat
Laatst
Lach
Lachen
Ladder
Laken
Lamp
Land
Lang
Langs
Laten
Leeg
Leeuw
Leger
Leiden
Lenen
Lengte
Lepel
Leren
Les
Leuk
Leven
Lezen
Licht
Liefde
Liegen
Liggen
Lijk
Lijken
Links
Lip
List
Lomp
Lood
Lopen
Los
Lot
Lucht
Lui
Lunch
Maag
Maal
Maan
Maand
Maar
Maat
Maken
Mama
Man
Mand
Manier
Map
Markt
Meel
Meer
Meest
Meisje
Melk
Meneer
Mensen
Mes
Met
Meubel
Middel
Midden
Mij
Mijn
Min
Minder
Minuut
Mis
Missen
Mits
Model
Modern
Moeder
Moeten
Mogen
Moment
Mond
Mooi
Moord
Morgen
Munt
Muziek
Naald
Naam
Naar
Naast
Nacht
Nat
Natuur
Nee
Neer
Negen
Nek
Nemen
Net
Netjes
Neus
Niet
Niets
Nieuw
Nieuws
Nobel
Noch
Nodig
Noemen
Nog
Nood
Nooit
Noord
Noot
Nul
Nummer
Object
Oceaan
Offer
Olie
Oma
Onder
Oneven
Ons
Onze
Oog
Ooit
Ook
Oom
Oor
Oorlog
Oost
Opa
Opeens
Open
Oranje
Orde
Oud
Ouder
Over
Overal
Paar
Paard
Pad
Pagina
Pan
Papa
Papier
Park
Pas
Pen
Peper
Per
Piano
Pijn
Plaat
Plaats
Plank
Plant
Plat
Plein
Plus
Poes
Poort
Praten
Prijs
Prins
Privé
Punt
Raak
Raam
Radio
Raken
Recht
Rechts
Redden
Reeds
Regen
Reiken
Reizen
Rennen
Rest
Rijk
Rijst
Rijzen
Ring
Rok
Rond
Rood
Rook
Rots
Roze
Rubber
Ruiken
Ruimte
Samen
Sap
Schaap
Schaar
Scherp
Schip
School
Schoon
Sex
Simpel
Sinds
Slapen
Slecht
Slim
Slot
Smaak
Smal
Sneeuw
Snel
Soep
Sok
Soms
Soort
Sorry
Spel
Spelen
Sport
Staal
Stad
Stap
Start
Steen
Stelen
Stem
Ster
Sterk
Steun
Stil
Stilte
Stoel
Stof
Stom
Stop
Storm
Straat
Studie
Stuk
Succes
Suiker
Taal
Taart
Tafel
Tak
Tand
Tante
Tas
Taxi
Team
Teen
Tegen
Teken
Tellen
Tennis
Terug
Test
Thee
Thuis
Tien
Tijd
Titel
Toen
Totaal
Traan
Tram
Trein
Trui
Tuin
Tussen
Tweede
Uit
Uur
Vaak
Vader
Vak
Vallen
Vals
Van
Vangen
Varken
Vast
Veel
Veer
Veilig
Ver
Verder
Verf
Vers
Vet
Vier
Vies
Vijand
Vijf
Vijver
Vinden
Vinger
Vis
Vlag
Vlees
Vlieg
Vloer
Voeden
Voelen
Voet
Vogel
Vol
Voor
Vork
Vorm
Vos
Vouwen
Vraag
Vragen
Vrede
Vreemd
Vriend
Vrij
Vroeg
Vrouw
Vullen
Vuur
Waar
Waarom
Wakker
Want
Wapen
Warm
Wassen
Wat
Water
Week
Weer
Weg
Welke
Welkom
Wens
Wereld
Werk
West
Wie
Wiel
Wij
Wijn
Wijs
Wild
Willen
Wind
Winkel
Winnen
Winter
Wissen
Wit
Wolf
Wolk
Wonder
Woord
Woud
Wreed
Zaak
Zacht
Zak
Zand
Zee
Zeep
Zeer
Zeggen
Zeil
Zeker
Zelfde
Zes
Zetten
Zeven
Ziek
Ziel
Zien
Zij
Zijn
Zilver
Zingen
Zinken
Zitten
Zoals
Zoeken
Zoet
Zomer
Zon
Zonder
Zonnig
Zoon
Zorg
Zorgen
Zou
Zout
Zuid
Zulke
Zullen
Zus
Zwaar
Zwak

X-plane on linux

Starting x-plane can be a problem on Linux when screens are not properly detected. (Like order of screens or sizes)

Below is a three-screen start script for Linux.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/bin/bash
#Will start a three screen xplane session
#Screen are @ 1920x1080 resolution
numscreens=3
count=0
if [ -z $1 ] ; then
./X-Plane-x86_64 --monitor_bounds=0,0,1920,1080,1920,0,1920,1080,3840,0,1920,1080
while [ $count -lt $numscreens ]; do
sleep 1
count=$( wmctrl -l | grep X-System | wc -l)
done
fi
screencount=1
wmctrl -l | grep X-Syst |awk '{ print $1 }' | while read ; do
wmctrl -i -r "$REPLY" -T "X-System_$screencount"
let screencount=screencount+1
done
wmctrl -r "X-System_1" -e 1,0,0,1920,1080
wmctrl -r "X-System_2" -e 1,1920,0,1920,1080
wmctrl -r "X-System_3" -e 1,3840,0,1920,1080
#!/bin/bash #Will start a three screen xplane session #Screen are @ 1920x1080 resolution numscreens=3 count=0 if [ -z $1 ] ; then ./X-Plane-x86_64 --monitor_bounds=0,0,1920,1080,1920,0,1920,1080,3840,0,1920,1080 while [ $count -lt $numscreens ]; do sleep 1 count=$( wmctrl -l | grep X-System | wc -l) done fi screencount=1 wmctrl -l | grep X-Syst |awk '{ print $1 }' | while read ; do wmctrl -i -r "$REPLY" -T "X-System_$screencount" let screencount=screencount+1 done wmctrl -r "X-System_1" -e 1,0,0,1920,1080 wmctrl -r "X-System_2" -e 1,1920,0,1920,1080 wmctrl -r "X-System_3" -e 1,3840,0,1920,1080
#!/bin/bash
#Will start a three screen xplane session
#Screen are @ 1920x1080 resolution
numscreens=3
count=0
if [ -z $1 ] ; then
./X-Plane-x86_64 --monitor_bounds=0,0,1920,1080,1920,0,1920,1080,3840,0,1920,1080
 while [  $count -lt $numscreens ]; do
    sleep 1
    count=$( wmctrl -l | grep X-System | wc -l)
 done
fi
screencount=1
wmctrl -l | grep X-Syst |awk '{ print $1 }' | while read ; do 
	wmctrl -i -r "$REPLY" -T "X-System_$screencount"
	let  screencount=screencount+1
done
wmctrl -r "X-System_1" -e 1,0,0,1920,1080
wmctrl -r "X-System_2" -e 1,1920,0,1920,1080
wmctrl -r "X-System_3" -e 1,3840,0,1920,1080

Ignition starter for flightsim

I’ve got several Saitec flightsim items, and building some additions myself.

For example i’ve got:

Yoke system
Multi panel (Autopilot/flaps/trim)
Add rudder pedals

But i really wanted the feeling of starting the engine with a knob.
So i build one using alumium scraps and a arduino.

It doesn’t look much, but it all be behind a metal sheet anyway.
Really pleased with the spring reset and multiple settings.

Personal BWW music files search engine.

I’ve a lot of bagpipe writer music files, many are the same tune but a little different.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
find -type f | egrep -i "bww$|bmw$" | wc -l
34565
find -type f | egrep -i "bww$|bmw$" | wc -l 34565
find -type f | egrep -i "bww$|bmw$" | wc -l
34565

Most contain information about composers, complete title, arrangements and information about harmony and seconds/thirds/whatever.

So I made a PHP search script and a BASH indexer.
(This is NOT a safe script to use servers with internet access)

PHP

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Strict Search: <form method="post" action="?"><input type="Text" name="words" size=40 value=""><input type="Submit" name="submit" value="search"></form>
Fuzzy Search: <form method="post" action="?"><input type="Text" name="words2" size=40 value=""><input type="Submit" name="submit" value="search">Fuzzy-ness<input type="Text" name="words2key" size=1 value="3"></form>
Parsons Search: <form method="post" action="?"><input type="Text" name="words3" size=40 value=""><input type="Submit" name="submit" value="search">Fuzzy-ness<input type="Text" name="words2key" size=1 value="3"></form>
<P><PRE>
<?PHP
if ($_POST['words']) {
$words = preg_replace("(\r\n|\n|\r)", "", $_POST['words']);
$words = preg_replace("/[^0-9a-z]/i",'', $words);
$command = "/bin/cat /var/www/html/findbww/bww.list |/bin/grep -i $words | sed 's/*\w\+//' | sed 's/\\/private\\/Private\\/Henri\\/save\\/move\\/cds-uitzoeken\\///g' ";
$blah=shell_exec($command);
$blah=str_replace("$words", "<b><font color=red>$words</font></b>",$blah);
print $blah;
}
if ($_POST['words2']) {
$words=$_POST['words2'];
$words2key=$_POST['words2key'];
$words = preg_replace("(\r\n|\n|\r)", "", $words);
$words = preg_replace("/[^0-9a-z]/i",'', $words);
$command = "/bin/cat /var/www/html/findbww/bww.list |/usr/bin/agrep -$words2key -i $words | sed 's/*\w\+//' | sed 's/\\/private\\/Private\\/Henri\\/save\\/move\\/cds-uitzoeken\\///g'";
$blah=shell_exec($command);
$blah=str_replace("$words", "<b><font color=red>$words</font></b>",$blah);
print $blah;
}
if ($_POST['words3']) {
$words=$_POST['words3'];
$words2key=$_POST['words2key'];
$words = preg_replace("(\r\n|\n|\r)", "", $words);
$words = preg_replace("/[^0-9a-z]/i",'', $words);
$command = "/bin/cat /var/www/html/findbww/bww.list.parsons |/usr/bin/agrep -$words2key -i $words | sed 's/*\w\+//' | sed 's/\\/private\\/Private\\/Henri\\/save\\/move\\/cds-uitzoeken\\///g'";
$blah=shell_exec($command);
$blah=str_replace("$words", "<b><font color=red>$words</font></b>",$blah);
print $blah;
}
?>
</PRE>
Strict Search: <form method="post" action="?"><input type="Text" name="words" size=40 value=""><input type="Submit" name="submit" value="search"></form> Fuzzy Search: <form method="post" action="?"><input type="Text" name="words2" size=40 value=""><input type="Submit" name="submit" value="search">Fuzzy-ness<input type="Text" name="words2key" size=1 value="3"></form> Parsons Search: <form method="post" action="?"><input type="Text" name="words3" size=40 value=""><input type="Submit" name="submit" value="search">Fuzzy-ness<input type="Text" name="words2key" size=1 value="3"></form> <P><PRE> <?PHP if ($_POST['words']) { $words = preg_replace("(\r\n|\n|\r)", "", $_POST['words']); $words = preg_replace("/[^0-9a-z]/i",'', $words); $command = "/bin/cat /var/www/html/findbww/bww.list |/bin/grep -i $words | sed 's/*\w\+//' | sed 's/\\/private\\/Private\\/Henri\\/save\\/move\\/cds-uitzoeken\\///g' "; $blah=shell_exec($command); $blah=str_replace("$words", "<b><font color=red>$words</font></b>",$blah); print $blah; } if ($_POST['words2']) { $words=$_POST['words2']; $words2key=$_POST['words2key']; $words = preg_replace("(\r\n|\n|\r)", "", $words); $words = preg_replace("/[^0-9a-z]/i",'', $words); $command = "/bin/cat /var/www/html/findbww/bww.list |/usr/bin/agrep -$words2key -i $words | sed 's/*\w\+//' | sed 's/\\/private\\/Private\\/Henri\\/save\\/move\\/cds-uitzoeken\\///g'"; $blah=shell_exec($command); $blah=str_replace("$words", "<b><font color=red>$words</font></b>",$blah); print $blah; } if ($_POST['words3']) { $words=$_POST['words3']; $words2key=$_POST['words2key']; $words = preg_replace("(\r\n|\n|\r)", "", $words); $words = preg_replace("/[^0-9a-z]/i",'', $words); $command = "/bin/cat /var/www/html/findbww/bww.list.parsons |/usr/bin/agrep -$words2key -i $words | sed 's/*\w\+//' | sed 's/\\/private\\/Private\\/Henri\\/save\\/move\\/cds-uitzoeken\\///g'"; $blah=shell_exec($command); $blah=str_replace("$words", "<b><font color=red>$words</font></b>",$blah); print $blah; } ?> </PRE>
Strict Search: <form method="post" action="?"><input type="Text" name="words" size=40 value=""><input type="Submit" name="submit" value="search"></form>
Fuzzy Search: <form method="post" action="?"><input type="Text" name="words2" size=40 value=""><input type="Submit" name="submit" value="search">Fuzzy-ness<input type="Text" name="words2key" size=1 value="3"></form>
Parsons Search: <form method="post" action="?"><input type="Text" name="words3" size=40 value=""><input type="Submit" name="submit" value="search">Fuzzy-ness<input type="Text" name="words2key" size=1 value="3"></form>

<P><PRE>
<?PHP
if ($_POST['words']) {
$words = preg_replace("(\r\n|\n|\r)", "", $_POST['words']); 
$words = preg_replace("/[^0-9a-z]/i",'', $words);
$command = "/bin/cat /var/www/html/findbww/bww.list |/bin/grep -i $words | sed 's/*\w\+//' | sed 's/\\/private\\/Private\\/Henri\\/save\\/move\\/cds-uitzoeken\\///g' ";
$blah=shell_exec($command);
$blah=str_replace("$words", "<b><font color=red>$words</font></b>",$blah);
print $blah;
}
if ($_POST['words2']) {
$words=$_POST['words2'];
$words2key=$_POST['words2key'];
$words = preg_replace("(\r\n|\n|\r)", "", $words); 
$words = preg_replace("/[^0-9a-z]/i",'', $words);
$command = "/bin/cat /var/www/html/findbww/bww.list |/usr/bin/agrep -$words2key -i $words | sed 's/*\w\+//' |  sed 's/\\/private\\/Private\\/Henri\\/save\\/move\\/cds-uitzoeken\\///g'";
$blah=shell_exec($command);
$blah=str_replace("$words", "<b><font color=red>$words</font></b>",$blah);
print $blah;
}
if ($_POST['words3']) {
$words=$_POST['words3'];
$words2key=$_POST['words2key'];
$words = preg_replace("(\r\n|\n|\r)", "", $words); 
$words = preg_replace("/[^0-9a-z]/i",'', $words);
$command = "/bin/cat /var/www/html/findbww/bww.list.parsons |/usr/bin/agrep -$words2key -i $words | sed 's/*\w\+//' |  sed 's/\\/private\\/Private\\/Henri\\/save\\/move\\/cds-uitzoeken\\///g'";
$blah=shell_exec($command);
$blah=str_replace("$words", "<b><font color=red>$words</font></b>",$blah);
print $blah;
}
?>
</PRE>

Bash indexer (uses agrep)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/bin/bash
[ `find /FULLPATH/Music/Bagpipe-music-writer/ -type f | wc -l` -eq 0 ] && exit
cd /var/www/html/findbww
: > bww.list
: > bww.list.parsons
locate -i bww | egrep -i "\.bww$" |grep -v html.bww| while read tunepath; do
tune=$(basename "$tunepath")
keywords=$(cat "$tunepath" | egrep -vi "FontSizes|FrequencyMappings|GracenoteDurations|InstrumentMappings|MIDINoteMappings|TuneFormat|VariationTempo|TuneTempo|Bagpipe Reader" | awk -F',\\(' '{ print $1 }'
| grep -v \"\" | grep -v ^! | grep -v "Converted from" | grep ^\" |tr '\n' ','| tr -d "\015")
parsons=$(./parsons "$tunepath")
echo "$tunepath,$tune,$keywords" >> bww.list
echo "$tunepath,$parsons" >> bww.list.parsons
done
locate -i bwm | egrep -i "\.bwm$" |grep -v html.bwm| while read tunepath; do
tune=$(basename "$tunepath")
keywords=$(cat "$tunepath" | egrep -vi "FontSizes|FrequencyMappings|GracenoteDurations|InstrumentMappings|MIDINoteMappings|TuneFormat|VariationTempo|TuneTempo|Bagpipe Reader" | awk -F',\\(' '{ print $1 }'
| grep -v \"\" | grep -v ^! | grep -v "Converted from" | grep ^\" |tr '\n' ','| tr -d "\015")
parsons=$(./parsons "$tunepath")
echo "$tunepath,$tune,$keywords" >> bww.list
echo "$tunepath,$parsons" >> bww.list.parsons
done
chown www-data bww.list*
#!/bin/bash [ `find /FULLPATH/Music/Bagpipe-music-writer/ -type f | wc -l` -eq 0 ] && exit cd /var/www/html/findbww : > bww.list : > bww.list.parsons locate -i bww | egrep -i "\.bww$" |grep -v html.bww| while read tunepath; do tune=$(basename "$tunepath") keywords=$(cat "$tunepath" | egrep -vi "FontSizes|FrequencyMappings|GracenoteDurations|InstrumentMappings|MIDINoteMappings|TuneFormat|VariationTempo|TuneTempo|Bagpipe Reader" | awk -F',\\(' '{ print $1 }' | grep -v \"\" | grep -v ^! | grep -v "Converted from" | grep ^\" |tr '\n' ','| tr -d "\015") parsons=$(./parsons "$tunepath") echo "$tunepath,$tune,$keywords" >> bww.list echo "$tunepath,$parsons" >> bww.list.parsons done locate -i bwm | egrep -i "\.bwm$" |grep -v html.bwm| while read tunepath; do tune=$(basename "$tunepath") keywords=$(cat "$tunepath" | egrep -vi "FontSizes|FrequencyMappings|GracenoteDurations|InstrumentMappings|MIDINoteMappings|TuneFormat|VariationTempo|TuneTempo|Bagpipe Reader" | awk -F',\\(' '{ print $1 }' | grep -v \"\" | grep -v ^! | grep -v "Converted from" | grep ^\" |tr '\n' ','| tr -d "\015") parsons=$(./parsons "$tunepath") echo "$tunepath,$tune,$keywords" >> bww.list echo "$tunepath,$parsons" >> bww.list.parsons done chown www-data bww.list*
#!/bin/bash
[ `find /FULLPATH/Music/Bagpipe-music-writer/ -type f  | wc -l` -eq 0 ] && exit
cd /var/www/html/findbww
: > bww.list
: > bww.list.parsons
locate -i bww |  egrep -i "\.bww$" |grep -v html.bww|  while read tunepath; do
tune=$(basename "$tunepath")
keywords=$(cat "$tunepath" |  egrep -vi "FontSizes|FrequencyMappings|GracenoteDurations|InstrumentMappings|MIDINoteMappings|TuneFormat|VariationTempo|TuneTempo|Bagpipe Reader" | awk -F',\\(' '{ print $1 }' 
| grep -v \"\" | grep -v ^! | grep -v "Converted from" | grep ^\" |tr '\n' ','| tr -d "\015")
parsons=$(./parsons "$tunepath")
echo "$tunepath,$tune,$keywords" >> bww.list
echo "$tunepath,$parsons" >> bww.list.parsons
done

locate -i bwm |  egrep -i "\.bwm$" |grep -v html.bwm|  while read tunepath; do
tune=$(basename "$tunepath")
keywords=$(cat "$tunepath" |  egrep -vi "FontSizes|FrequencyMappings|GracenoteDurations|InstrumentMappings|MIDINoteMappings|TuneFormat|VariationTempo|TuneTempo|Bagpipe Reader" | awk -F',\\(' '{ print $1 }' 
| grep -v \"\" | grep -v ^! | grep -v "Converted from" | grep ^\" |tr '\n' ','| tr -d "\015")
parsons=$(./parsons "$tunepath")
echo "$tunepath,$tune,$keywords" >> bww.list
echo "$tunepath,$parsons" >> bww.list.parsons
done
chown www-data bww.list*

Converting for parsons code.
See https://www.henriaanstoot.nl/2022/03/23/20-years-www-pipetunesearch-org/
and https://en.wikipedia.org/wiki/Parsons_code

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#!/bin/bash
echo -n "\""
for f in `cat "$1"` ;do echo "$f" | tr -cd "[A-HL]_[0-9]" ; echo ; done | grep -v '^$' |grep _ > /tmp/parsons
let count=0
for f in `cat /tmp/parsons| tr -cd "[A-HL] \n"` ;do
if [ "$f" = "LG" ] ; then g=0; fi
if [ "$f" = "LA" ] ; then g=1; fi
if [ "$f" = "B" ] ; then g=2; fi
if [ "$f" = "C" ] ; then g=3; fi
if [ "$f" = "D" ] ; then g=4; fi
if [ "$f" = "E" ] ; then g=5; fi
if [ "$f" = "F" ] ; then g=6; fi
if [ "$f" = "HG" ] ; then g=7; fi
if [ "$f" = "HA" ] ; then g=8; fi
if [ $count -eq 0 ] ;then
echo -n "*";
((count++))
last=$g
else
if [ "2$g" -eq "2$last" ] ; then echo -n "r" ; fi
if [ "2$g" -lt "2$last" ] ; then echo -n "d" ; fi
if [ "2$g" -gt "2$last" ] ; then echo -n "u" ; fi
last=$g
fi
done
echo "\""
#!/bin/bash echo -n "\"" for f in `cat "$1"` ;do echo "$f" | tr -cd "[A-HL]_[0-9]" ; echo ; done | grep -v '^$' |grep _ > /tmp/parsons let count=0 for f in `cat /tmp/parsons| tr -cd "[A-HL] \n"` ;do if [ "$f" = "LG" ] ; then g=0; fi if [ "$f" = "LA" ] ; then g=1; fi if [ "$f" = "B" ] ; then g=2; fi if [ "$f" = "C" ] ; then g=3; fi if [ "$f" = "D" ] ; then g=4; fi if [ "$f" = "E" ] ; then g=5; fi if [ "$f" = "F" ] ; then g=6; fi if [ "$f" = "HG" ] ; then g=7; fi if [ "$f" = "HA" ] ; then g=8; fi if [ $count -eq 0 ] ;then echo -n "*"; ((count++)) last=$g else if [ "2$g" -eq "2$last" ] ; then echo -n "r" ; fi if [ "2$g" -lt "2$last" ] ; then echo -n "d" ; fi if [ "2$g" -gt "2$last" ] ; then echo -n "u" ; fi last=$g fi done echo "\""
#!/bin/bash
echo -n "\""
for f in `cat "$1"` ;do echo "$f" |  tr -cd "[A-HL]_[0-9]" ; echo  ; done | grep -v '^$' |grep _ > /tmp/parsons
let count=0
for f in `cat /tmp/parsons| tr -cd "[A-HL] \n"` ;do
  if [ "$f" = "LG" ] ; then g=0; fi
  if [ "$f" = "LA" ] ; then g=1; fi
  if [ "$f" = "B" ] ; then g=2; fi
  if [ "$f" = "C" ] ; then g=3; fi
  if [ "$f" = "D" ] ; then g=4; fi
  if [ "$f" = "E" ] ; then g=5; fi
  if [ "$f" = "F" ] ; then g=6; fi
  if [ "$f" = "HG" ] ; then g=7; fi
  if [ "$f" = "HA" ] ; then g=8; fi
 if [ $count -eq 0 ] ;then 
  echo -n "*"; 
  ((count++))
  last=$g
 else
 if [ "2$g" -eq "2$last" ] ; then echo -n "r" ; fi
 if [ "2$g" -lt "2$last" ] ; then echo -n "d" ; fi
 if [ "2$g" -gt "2$last" ] ; then echo -n "u" ; fi
 last=$g
fi
done
echo "\""

Just place all files in a directory on a php enabled webserver.
The bash script is being run daily.
(parsons bash script is called from this main script)
These will generate 2 files
One with the filename and all useful text like composers.
And a file with the filename and the parsons code.
Example:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
11th of September, The.bww,"*udduddudduddudurrdudrrdudduddudrrduuuuududurrdudrrurrdududurrdudrrduddudurrduudduddudduddududdurdudrurdduddududr
urduuudrduddurdudrudrurduududdurdudrurdduddururdududduddudduddudruddudruddudduddudruddruududududududrudurddrududruddudrudduddudurddrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrud
rrudrrudrrudrrudrrudrrudrrudrrudrrudrruuduuduuduuduuduuudrduuduurduuduuurdrduuduuduuuduurduuduuduuduuduu"
11th of September, The.bww,"*udduddudduddudurrdudrrdudduddudrrduuuuududurrdudrrurrdududurrdudrrduddudurrduudduddudduddududdurdudrurdduddududr urduuudrduddurdudrudrurduududdurdudrurdduddururdududduddudduddudruddudruddudduddudruddruududududududrudurddrududruddudrudduddudurddrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrud rrudrrudrrudrrudrrudrrudrrudrrudrrudrruuduuduuduuduuduuudrduuduurduuduuurdrduuduuduuuduurduuduuduuduuduu"
11th of September, The.bww,"*udduddudduddudurrdudrrdudduddudrrduuuuududurrdudrrurrdududurrdudrrduddudurrduudduddudduddududdurdudrurdduddududr
urduuudrduddurdudrudrurduududdurdudrurdduddururdududduddudduddudruddudruddudduddudruddruududududududrudurddrududruddudrudduddudurddrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrudrrud
rrudrrudrrudrrudrrudrrudrrudrrudrrudrruuduuduuduuduuduuudrduuduurduuduuurdrduuduuduuuduurduuduuduuduuduu"

Example screenshots

Fun with Xrandr

xrandr is an official configuration utility to the RandR (Resize and Rotate) X Window System extension. It can be used to set the size, orientation or reflection of the outputs for a screen.

Someone broke my screen at a hackers event. The terminal was really hard to read with the black parts, so i tilted the screen

Quiet friday at work, playing with my little trusty 2530p.
I’m using xmonad, so i don’t need any fancy work laptop.

Another quiet friday at work, working from home, i turned all monitoring displays upside-down, sideways, or rotated them every so much seconds.

While this is a lot of fun to use, i used this to get my monitorsetups exactly the way i wanted, at home or at work.
Different screen sizes, height differences .. no problem.

A fun tool to use is:
https://github.com/qurn/xrandr-keystone-helper

Some scripts:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# VGA off
xrandr --output VGA1 --off
# examples
xrandr --output LVDS1 --mode 1280x800 --output VGA1 --mode 1280x1024 --pos 0x1280 --left-of LVDS1
xrandr --output LVDS-1 --mode 1280x800 --output SVIDEO-1 --mode 1920x1080 --pos 0x0 --left-of SVIDEO-1
xrandr --output LVDS-1 --mode 1280x800 --pos 0x1920 --output VGA-1 --mode 1920x1080 --pos 0x2200 --right-of LVDS-1 --output DVI-I-1-1 --mode 1920x1080 --pos 0x0 --left-of LVDS-1
# zoomthingy
xrandr --output VGA1 --mode 1920x1080 --panning 1920x1080
xrandr --output VGA1 --mode 640x480 --panning 1920x1080+2910+0 --scale 1x1
# fix detection
xrandr --setprovideroutputsource 1 0
# add mode
xrandr --addmode DP-1 1440x720
# transform (see also terminal picture above)
xrandr --output LVDS --mode 1366x768 --panning 1166x768 --transform 1,0,-200,0,1,0,0,0,1
# Funky stuff
for f in `seq 1 9` ;do echo xrandr --output LVDS1 --transform 0.5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do echo xrandr --output LVDS1 --transform 0.5403,-0.8$f41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.1$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 2; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.4$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.5$(echo -n $f)841,0.5403,0,0,0,1.5 ; sleep 1; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.4$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.5$(echo -n $f)841,0.5$(echo -n $f)403,0,0,0,1.5 ; sleep 1; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.4$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.$(echo -n $f)841,0.5403,0,0,0,1.5 ; sleep 2; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5403,-0.8$f41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5$(echo -n $f)403,-0.8$(echo -n $f)41,0,0.8$(echo -n $f)41,0.5$(echo -n $f)403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5$f403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5$f403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1; done
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 2; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.$f403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.1,0.1,0,0.1,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform -0.11038,0.993888,0,-0.99388,-0.11038,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform -0.11,0.99,0,-0.99,-0.11,0,0,0,1
xrandr --output LVDS1 --transform 0.15425,0.988,0,-0.988,0.15425,0,0,0,1
xrandr --output LVDS1 --transform 0.2,-0.2,0,0.2,0.2,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5,-0.5,0,0.5,0.5,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5,0.5,0,0.5,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.54030,-0.841,0.841,0.54030,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.54030,-0.841,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,0.1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1.1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0.1,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform -0.5403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,-0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,-0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1 --scale 2x2; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,2 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0.1,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0.1,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0.1,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0.1,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.1,30,0.1,0.9,-80,0,0,0.8 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 --scale 1.1x1.1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 --scale 1.5x1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 --scale 2x2 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.9,-0.1,30,0.1,0.9,-80,0,0,0.8 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 1.1,1.1,0,1.1,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 2.1,2.1,0,2.1,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
# VGA off xrandr --output VGA1 --off # examples xrandr --output LVDS1 --mode 1280x800 --output VGA1 --mode 1280x1024 --pos 0x1280 --left-of LVDS1 xrandr --output LVDS-1 --mode 1280x800 --output SVIDEO-1 --mode 1920x1080 --pos 0x0 --left-of SVIDEO-1 xrandr --output LVDS-1 --mode 1280x800 --pos 0x1920 --output VGA-1 --mode 1920x1080 --pos 0x2200 --right-of LVDS-1 --output DVI-I-1-1 --mode 1920x1080 --pos 0x0 --left-of LVDS-1 # zoomthingy xrandr --output VGA1 --mode 1920x1080 --panning 1920x1080 xrandr --output VGA1 --mode 640x480 --panning 1920x1080+2910+0 --scale 1x1 # fix detection xrandr --setprovideroutputsource 1 0 # add mode xrandr --addmode DP-1 1440x720 # transform (see also terminal picture above) xrandr --output LVDS --mode 1366x768 --panning 1166x768 --transform 1,0,-200,0,1,0,0,0,1 # Funky stuff for f in `seq 1 9` ;do echo xrandr --output LVDS1 --transform 0.5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 for f in `seq 1 9` ;do echo xrandr --output LVDS1 --transform 0.5403,-0.8$f41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.1$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 2; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.4$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.5$(echo -n $f)841,0.5403,0,0,0,1.5 ; sleep 1; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.4$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.5$(echo -n $f)841,0.5$(echo -n $f)403,0,0,0,1.5 ; sleep 1; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.4$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.$(echo -n $f)841,0.5403,0,0,0,1.5 ; sleep 2; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5403,-0.8$f41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5$(echo -n $f)403,-0.8$(echo -n $f)41,0,0.8$(echo -n $f)41,0.5$(echo -n $f)403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5$f403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5$f403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1; done for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 2; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.$f403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.1,0.1,0,0.1,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform -0.11038,0.993888,0,-0.99388,-0.11038,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform -0.11,0.99,0,-0.99,-0.11,0,0,0,1 xrandr --output LVDS1 --transform 0.15425,0.988,0,-0.988,0.15425,0,0,0,1 xrandr --output LVDS1 --transform 0.2,-0.2,0,0.2,0.2,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5,-0.5,0,0.5,0.5,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5,0.5,0,0.5,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.54030,-0.841,0.841,0.54030,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.54030,-0.841,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,0.1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1.1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0.1,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform -0.5403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0,-0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,-0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1 --scale 2x2; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,2 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0.1,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0.1,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0.1,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0.1,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.5403,-0.841,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.9,-0.1,30,0.1,0.9,-80,0,0,0.8 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 --scale 1.1x1.1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 --scale 1.5x1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 --scale 2x2 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 0.9,-0.9,-0.1,30,0.1,0.9,-80,0,0,0.8 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 1.1,1.1,0,1.1,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1 xrandr --output LVDS1 --transform 2.1,2.1,0,2.1,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
# VGA off
xrandr --output VGA1 --off

# examples
xrandr --output LVDS1 --mode 1280x800 --output VGA1 --mode 1280x1024 --pos 0x1280 --left-of LVDS1
xrandr --output LVDS-1 --mode 1280x800 --output SVIDEO-1 --mode 1920x1080 --pos 0x0 --left-of SVIDEO-1
xrandr --output LVDS-1 --mode 1280x800 --pos 0x1920 --output VGA-1 --mode 1920x1080 --pos 0x2200 --right-of LVDS-1 --output DVI-I-1-1 --mode 1920x1080 --pos 0x0 --left-of LVDS-1

# zoomthingy
xrandr --output VGA1 --mode 1920x1080 --panning 1920x1080
xrandr --output VGA1 --mode 640x480 --panning 1920x1080+2910+0 --scale 1x1

# fix detection
xrandr --setprovideroutputsource 1 0

# add mode
xrandr --addmode DP-1 1440x720

# transform (see also terminal picture above)
xrandr --output LVDS --mode 1366x768 --panning 1166x768 --transform 1,0,-200,0,1,0,0,0,1

# Funky stuff
for f in `seq 1 9` ;do echo xrandr --output LVDS1 --transform 0.5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do echo xrandr --output LVDS1 --transform 0.5403,-0.8$f41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.1$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 2; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.4$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.5$(echo -n $f)841,0.5403,0,0,0,1.5 ; sleep 1; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.4$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.5$(echo -n $f)841,0.5$(echo -n $f)403,0,0,0,1.5 ; sleep 1; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.4$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.$(echo -n $f)841,0.5403,0,0,0,1.5 ; sleep 2; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5403,-0.8$f41,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5$(echo -n $f)403,-0.8$(echo -n $f)41,0,0.8$(echo -n $f)41,0.5$(echo -n $f)403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5$f403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.5$f403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1; done
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.$(echo -n $f)5403,-0.8$(echo -n $f)41,0,0.841,0.5403,0,0,0,1.5 ; sleep 2; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
for f in `seq 1 9` ;do xrandr --output LVDS1 --transform 0.$f403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5; done ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.1,0.1,0,0.1,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform -0.11038,0.993888,0,-0.99388,-0.11038,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform -0.11,0.99,0,-0.99,-0.11,0,0,0,1
xrandr --output LVDS1 --transform 0.15425,0.988,0,-0.988,0.15425,0,0,0,1
xrandr --output LVDS1 --transform 0.2,-0.2,0,0.2,0.2,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5,-0.5,0,0.5,0.5,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5,0.5,0,0.5,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.54030,-0.841,0.841,0.54030,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.54030,-0.841,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,0.1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1.1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0.1,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform -0.5403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,-0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,-0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,0.841,0,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1 --scale 2x2; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0,0,2 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0,0.1,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0,0.841,0.5403,0.1,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0.1,0.841,0.5403,0,0,0,1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0.1,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.5403,-0.841,0.841,0.5403,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.1,30,0.1,0.9,-80,0,0,0.8 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 --scale 1.1x1.1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 --scale 1.5x1.5 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 --scale 2x2 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.9,0,0.9,0.9,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 0.9,-0.9,-0.1,30,0.1,0.9,-80,0,0,0.8 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 1.1,1.1,0,1.1,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1
xrandr --output LVDS1 --transform 2.1,2.1,0,2.1,1,0,0,0,1 ; sleep 5 ; xrandr --output LVDS1 --transform 0,0.10,-124,0,1.24,0,0,0.000316,1 --scale 1x1