Saturday, December 02, 2017

Multiple Desktops in Windows 10

Was pleasantly surprised today to see Microsoft finally implemented a Win 10 multi desktop feature in some of the more recent updates that's long been a staple of Linux window managers and OSX for some time. Multi desktop is now as easy as Ctrl+Win+D and swapping between them is also Ctrl+Win+Left/Right. Win+Tab to manage/close any desktop at the bottom of the screen. In summary


Ctrl+Win+D: Create a new desktop

Ctrl+Win+Left Arrow: Move left one desktop

Ctrl+Win+Right Arrow: Move right one desktop

Win+Tab: Manage desktops (Also a nice app switcher)


If you are a fan of tabbed browsing think of this as tabbed desktops where you can organize windows you are working into a logical grouping. IE chat/email/calendar in one set, whatever you are working on in another, youtube/music/streaming in another, etc.

Thursday, August 25, 2016

Mosh on Ubuntu with UFW firewall

Finally decided to give Mosh a spin due to some connection reliability issues at one location. Was glad to see it simply sits alongside SSH and is a breeze to setup with the one & only caveat being I had to open some ports on the server side.

First simply install Mosh

apt install mosh

Then if you are using ufw add firewall rules to let the mosh server communicate...

ufw allow 60000:60100/udp

Tuesday, July 05, 2016

Jared's Arduino i2c Scanner

If I update this will likely post updates here: https://github.com/jared0x90/ArduinoUnoI2CScanner/blob/master/i2c_scanner.ino
/*
   Jared's Arduino Uno R3 i2c Scanner

   Notes
   -----
   Set serial to 115200
   Tested on the Arduino Uno R3 and several clones.

   i2c Pins
   --------
   SDA = A4
   SCL = A5

   inspired by Circuit Magic's
   http://www.circuitmagic.com/arduino/oled-display-i2c-128x64-with-arduino-tutorial/

  Copyright (c) 2016 Jared De Blander
  jared@deblander.org

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.   
*/

#include <Wire.h>
#define SCAN_DELAY_SECONDS    5

void setup()
{
  Wire.begin();
  Serial.begin(115200);
}

void loop()
{
  bool found[128];

  byte error;
  byte address;

  int error_count;
  int device_count;


  error_count = 0;
  device_count = 0;
  /*
     Scan from address 0x01 to 0x7F.
     Address 0x00 is the general call address and should not be scanned
     http://www.i2c-bus.org/addressing/general-call-address/
  */

  Serial.println("Scanning i2c from 0x01 to 0x7F...");

  for (address = 0x01; address <= 0x7F; address++ ) {
    /*
       Assume no device at this address
    */
    found[address] = false;

    Serial.print("Trying 0x");
    if (address < 16) Serial.print("0");
    Serial.print(address, HEX);
    Serial.print("... ");
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0) {
      /*
         A device was found. Record device found at this address
      */
      found[address] = true;
      Serial.print("i2c device found! Address: 0x");
      if (address < 16) Serial.print("0");
      Serial.print(address, HEX);
      device_count++;
    } else if (error == 4) {
      error_count++;
      Serial.print("Unknow error! Address: 0x");
      if (address < 16) Serial.print("0");
      Serial.print(address, HEX);
    } else {
      Serial.print("Nothing found. Code: 0x");
      Serial.print(error, HEX);
    }
    Serial.println();
  }
  Serial.println("--------------------------------------");
  if (device_count == 0) {
    Serial.println("No i2c devices found");
  } else {
    Serial.print("i2c Device Count: ");
    Serial.println(device_count);
    Serial.println("Device listing: ");
    for (address = 1; address <= 127; address++ ) {
      if (found[address]) {
        Serial.print("0x");
        if (address < 16) Serial.print("0");
        Serial.println(address, HEX);
      }
    }
  }
  Serial.println("--------------------------------------");
  if (error_count == 0) {
    Serial.println("No errors detected this scan.");
  } else {
    Serial.print("Error count: ");
    Serial.println(error_count);
  }
  Serial.println("--------------------------------------");
  Serial.print("Next scan in ");
  Serial.print(SCAN_DELAY_SECONDS);
  Serial.print(" seconds");
  for (int delay_counter = 0; delay_counter < SCAN_DELAY_SECONDS; delay_counter++) {
    delay(1000);
    Serial.print(".");
  }
  Serial.println();
}

Wednesday, June 22, 2016

Arduino Uno Blinky App with Serial Blink Counter

/*
  Blink2
  by Jared De Blander
  adapted from Blink by Scott Fitzgerald
 */

#define LED_PIN       13      // LED pin
#define TIME_MS_ON    30      // LED on time
#define TIME_MS_OFF   70      // LED off time
#define UART_BAUD     9600    // Serial baud rate

#define S_BLINK_NUM   "Blink # "

unsigned long blink_counter = 0;

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(LED_PIN, OUTPUT);
  // turn on serial
  Serial.begin(UART_BAUD);
}

// the loop function runs over and over again forever
void loop() {
  blink_counter++;
  digitalWrite(LED_PIN, HIGH);      // turn the LED on (HIGH is the voltage level)
  Serial.print(S_BLINK_NUM);        // write the blink event out of the serial port
  Serial.println(blink_counter);    // along with the counter
  delay(TIME_MS_ON);                // wait for the on time in milliseconds (TIME_MS_ON)
  digitalWrite(LED_PIN, LOW);       // turn the LED off by making the voltage LOW
  delay(TIME_MS_OFF);               // wait for the off time in milliseconds (TIME_MS_ON)
}