Ted Piotrowski

Code to live. Live to spend time outdoors.

Page 2


Broken video attachments in Gmail

My sister often emails video attachments of my niece and nephew. Gmail provides a really sleek mechanism for viewing the attached videos without leaving the browser by playing them in an embedded YouTube player. However, at some point the YouTube player started presenting me with the following message: “An error occurred. Please try again later.” Let’s dig in.

blog1.jpg

The cause

Disabling third-party cookies in my browsers was the cause of this issue. Some browsers like Firefox have this disabled by default. To see if you’re video playback is broken for the same reason visit this page. If you see “Third party cookies appear to be disabled”, then read on for the solution.

Background: third-party cookies

When you log in to a website like Gmail you provide your email/password and in the background Gmail’s servers send you back a cookie containing a session ID (for example...

Continue reading →


Designing Slouch Cam

Screen Shot 2017-06-19 at 8.01.02 AM.png

Recently I’ve had some free time to take up another personal project. The idea is that your computer’s web cam watches your head position and alerts you if it gets too close to the screen. My mind has never been able to kick the habit that the closer I bring my face to the screen the better I will understand whatever is written on it. And so we come to my golden rule of side projects:

Build something that benefits your life. This will provide you intrinsic motivation (happiness) while you wait for the extrinsic motivators (money, fame) to kick in.

I’ve seen a lot of people violate this rule by brainstorming business ideas that can make a lot of money but don’t affect the creator personally. My view is these founders will run out of steam long before their project earns them a full time paycheck.

But I digress….

The design

I wanted to follow two design principles:

Limit wordy

...

Continue reading →


Aspiring Flats and Rock of the Ages bivvy

FullSizeRender 31.jpegMeadow at Aspiring Flats

Most people who spend time in Wanaka will drive down the west Matukituki valley and hike to Rob Roy glacier. The less popular East Matukituki valley offers a seldom travelled alternative. In fact, I found the valley devoid of human life the evening I hiked in. Plenty of cows, though. The most accessible destinations of interest are the Aspiring Flats and Rock of the Ages bivvy which are located on a tributary of the East Matuktuki.

FullSizeRender 35.jpegFollow this road, second valley on left in the distance is your destination

The walk begins by crossing an impressive bridge across the West Matutuki. Follow the route markers along the true left bank until you come to private land. You’ll need to remove your shoes for three water crossing before heading north along a road for some time. You will go through a gate. Next follow a long, long fence. There is a worn road running...

Continue reading →


Using a Raspberry PI as an AirPrint server

I’ve had my Brother HL2170W laser printer since January 2010, before AirPrint printers were really a thing. It’s been a solid printer and still has 90% of its second cartridge left. I’ve had an iPhone since around 2010 as well and I was under the mistaken impression that the two devices could never talk to each other. True, the devices are not directly compatible, but it is possible to use a Raspberry Pi as a mediator to have the two work together. Here’s a quick run down of how works in under four minutes:

View →


Running NodeJS, NPM and Git on Windows 10 without Administrator privileges

  1. Download NodeJS zip (http://nodejs.org/dist/latest/), likely the *-win-x64.zip version and unzip inside ~/AppData/Local/Programs/node1
  2. Download git for windows (https://git-for-windows.github.io/)
  3. Run installer
    1. Uncheck all components except Use TrueType font
    2. select Use Git from Git Bash only
    3. You can leave default line ending conversion
    4. Use Windows’ default console window
    5. Check file system caching and Credential Manager
  4. Run git bash shell
  5. vi .bash_profile or use notepad.exe to create it in your user directory

    PATH=$PATH:~/AppData/Local/Programs/node
    PATH=$PATH:/c/Windows/System32/
    
  6. Restart git bash shell or run source .bash_profile

  7. Clone your github repo over HTTPS (no SSH keys required). Credential manager can store your password.

  8. Cd into project and npm install2

  9. Go forth and profit

Bonus: Visual Studio Code

Visual Studio Code is my favorite editor and it’s free.

  1. ...

Continue reading →


Browsing on a Chromebook using a SOCKS proxy

How to watch HBOGO abroad on your Chromebook?

  1. Turn on developer mode on your Chromebook
  2. Press Ctrl+Alt+T to open a shell window and type shell at the prompt
  3. Start a SOCKS proxy server on your laptop that forwards traffic through a server in the USA you can access via SSH
    ssh -D 20001 user@serverintheusa
  4. Configure your Chromebook connection to use the local proxy.

Screenshot 2016-07-05 at 5.42.52 PM.png

4a. Click on your active Wifi connection to bring up the proxy configuration. Fill in the appropriate SOCKS host and port.

Screenshot 2016-07-05 at 5.42.30 PM.png

4b. You should now be able to access HBOGO

Screenshot 2016-07-05 at 5.43.56 PM.png

What is a proxy?

A proxy acts as a middle-man for your internet traffic. If you want to read cnn.com, instead of issuing a request for that page directly from your browser, you would first issue this request to a proxy server. The proxy would then request the contents of cnn.com and once it received the response, it would return the requested data back...

Continue reading →


Ford Focus heat shield fix

I recently noticed some tin-can rattling coming from the underside of my mom’s car. Google'ing pointed me towards the rear heat shield coming loose. I used some aluminum flashing and oversized washers to fasten it back in place.

Tools:

  1. Scissors
  2. 10mm socket wrench
  3. WD-40
  4. Framing nail + hammer

Parts:

  1. 10-24 nylon lock nuts
  2. 3/16" x 1 ¼" washers
  3. aluminum flashing

View →


Debugging load cells and HX711

I’m working on a system to determine how long it takes to air dry laundry. As the fabric dries, it becomes lighter. The idea is to measure the weight of drying laundry and when it stops decreasing you know it is dry.

Enter: the load cell. Load cells convert force measurements (such as weight) into electrical signals. They’re found in most digital kitchen scales. If we can hang a piece of laundry from the load cell and feed the reading to a computer, we’ll be able to get the data we’re after.

Load Cell Cantilever.jpg

Image from http://2.bp.blogspot.com/

I decided to use a strain gauge load cell because it can measure hanging force easily, and it’s cheap and plentiful on Amazon.com. Grab a volt meter and a variable power supply and lets demonstrate how a load cell works.

Screenshot 2016-06-13 at 1.33.37 PM.png

Reading a load cell

A load cell comes with four wires. Red and black wires for voltage in and ground (5-10V). Two additional wires...

Continue reading →


Move over Macbook Air

fg (1).png

Image from asus.com

I bought an ASUS Chromebook Flip recently and it’s been a treat. The 4GB model sells for $279, but you can always find an “opened box” model on Amazon Warehouse deals for around $220. I guess some people are not thrilled with the Chromebook (browserallthethings) approach and send them back barely used. Their loss, your gain.

I’ve been looking at tablets for sometime, but could not find the winning tablet/keyboard combo. The desire is to be able to read articles/docs + watch movies comfortably, but be able to shoot off a lengthy email and write some code as well. The Chromebook Flip has a 360 degree hinge allowing it to act as a tablet and a traditional laptop as well. Win. It’s also light (less than a kg) and super thin (1.5cm).

The Flip is one of the few Chromebooks that runs on ARM making it very power efficient. No more sprints for the charger because battery...

Continue reading →


First 3D printing project

3D printing is the process of creating models by stacking layers of thermoplastic on top of each other. It’s similar to icing a cake. There are some rules to follow. Each additional vertical layer can only overhang the previous layer at a 45 degree angle. This means you can 3D print a capital letter Y because the branches go up at a gradual 45 degree angle. A capital letter T would collapse, however, because the crossbar is an abrupt 90 degree angle.

It’s good to start learning 3D printing by trying to recreate an existing part. I used a part from a broken pair of headphones. The part is responsible for holding the headphone headband together. I chose this part because it has a simple geometric design and because I had the broken part available for measurement.

Printed replacement along with broken piece

You create your 3D model in a free program called SketchUp. I learned the necessary SketchUp skills in a one hour class at...

Continue reading →