Monday, December 7, 2020

L2TP with Raspberry PI

Make sure the debug dump option is not used -- otherwise it will crash pppd.

/etc/ppp/options.l2tpd.client:


ipcp-accept-local

ipcp-accept-remote

refuse-eap

require-mschap-v2

noauth

mtu 1200

mru 1200

noipdefault

debug

defaultroute

usepeerdns

connect-delay 5000

name <username>

password <password>


/etc/ipsec.conf:


# ipsec.conf - strongSwan IPsec configuration file


# basic configuration


config setup

  # strictcrlpolicy=yes

  # uniqueids = no


# Add connections here.


# Sample VPN connections


conn %default

  ikelifetime=60m

  keylife=20m

  rekeymargin=3m

  keyingtries=1

  keyexchange=ikev1

  authby=secret

  ike=3des-sha1-modp1024!

  esp=3des-sha1!


conn myvpn

  keyexchange=ikev1

  left=%defaultroute

  auto=add

  authby=secret

  type=transport

  leftprotoport=17/1701

  rightprotoport=17/1701

  right=<IP address>

Thursday, March 26, 2020

Overscan monitor issues on HP 2509m

If you're noticing that you can't see the title bar and the bottom status bar, it's because the overscan settings need to be changed.

The instructions at the bottom of this blog post (https://ishan.co/external-monitor-underscan) worked for me:

 1. Make a backup of the current file:
 2. cp /var/db/.com.apple.iokit.graphics /tmp/.com.apple.iokit.graphics.backup
 3. With the “troubled” monitor connected, open Display Preferences, and change its settings. For example, I changed the rotation.
 4. Run the “diff” command to see what had changed in that file after you made the changes:

56a57,58
>   framebuffer-rotation
>   0
58c60
<   10000
---
>   9000

5. I derived 9000 from -10% less overscan, which works great!

The process is automated in this Bashmatic script! (https://github.com/pioneerworks/lib-bash/blob/master/lib/osx.sh#L41-L53)

Sunday, February 3, 2019

How I fixed a 17-year old HP scanner...

Fixed! I've had this HP LaserJet 3330 multi-function printer (3300mfp) since 2002, but one day it started making a clicking/grinding noise, which is a common issue in this printer. The key to fixing is taking apart the entire unit and cleaning the mirrors and lens on the scanner unit (see YouTube video)


What exactly is the issue? It turns out that the scanner during startup tries to find its home position at the edge. When the scanner lid is closed, the light will reflect down onto mirrors. There are 5 of these mirrors that eventually bounce the light towards a CCD sensor:

I had done this mirror cleaning a few years ago and it worked miraculously. However, this time around the problem started happening again but the mirrors seemed fairly clean. What I didn't realize and what the repair videos don't mention is that I also had to clean the lens.  You can clean the front easily but to get to the back of the lens, the board on the back of the scanner unit has to be removed. This article seems to suggest you can get access to the scanner unit without taking the entire printer apart, but if you need access to the board, there are really no shortcuts.


There were small glue residue on the screws, so I had to use a power screwdriver to remove them. You can see in the pictures how the lens is fogged up:


After cleaning with a Q-Tip and alcohol, this lens starts to become cleaner:


Upon putting everything back, I noticed the printer continued to show "warming up bulb" on startup. I think the problem could be traced to some of the residue from the glue when I removed the board causing issues on the board. I managed to scrape away the residue and use painter's tape to lift it off the board. 

To verify whether the circuit board that I had just removed was at issue, I also started using a voltmeter and testing the ground and power (Vcc) pins of each of the integrated chips on the board while the board was plugged in while leaving the gray scanner lid off. There are a few commodity parts, which includes the CCD sensor (UPD8861), an inverter (74vhc04), a Schmitt trigger, and a voltage regulator that outputs 12 volts.

It suddenly worked! And I didn't have to buy a new unit (51000104-0000 on Ebay).

Note: I did try to reset the printer's memory by holding down "*" and # on power-up.  But I stopped doing it after it didn't seem to help.

Other notes from the HP forum here.

Wednesday, November 21, 2018

Seeing ints instead of booleans from your memcache?

The latest PyLibMc has changed the way in which booleans are stored from strings to integers to avoid conflicts in which python-memcached manages them. The end result? If you were noticing that your cache is returning ints instead of True/False, this change in PyLibMC cached this issue!

https://github.com/lericson/pylibmc/issues/242

If you have API responses that are returning invalid values, you'll need to wrap the value in bool() to fix the issue!

Friday, November 24, 2017

Testing SSL on Erlang

ssl:start().
{ok, ListenSocket} = ssl:listen(8443, [{certfile, "server.pem"}, {keyfile, "server.key"}, {cacertfile, "server.chain"}, {reuseaddr, true}]).
{ok, Socket} = ssl:transport_accept(ListenSocket).
ok = ssl:ssl_accept(Socket).

Wednesday, March 9, 2016

Project Fi and B010 error codes


  • If you purchase a Google phone, make sure to buy it under the @gmail.com account that will activate the Fi service.  Otherwise, you will end up seeing B010 error codes when trying to activate!

    Otherwise, you will have to call Project Fi specialists and have the "asset id" transferred to the account owner that intends to activate service.  You need to have both parties on the phone to have this info transferred.  This lesson took 3 weeks to resolve after calling multiple times to their 24x7 support line!
  • Google Fi leverages the Google Voice infrastructure.  You have to decide upfront whether to port your existing Google Voice line or port your cell phone.  If you decide to test out Project Fi and wish to bring your own phone line over later, you must cancel the service and then order another SIM card.  Google currently has no way of letting you to try before committing.  


Thursday, April 23, 2015

Redcarpet

Redcarpet is a Ruby library for rendering markup language.   When updating a CodePath Wiki guide entry, which hosts these documents outside of GitHub, I noticed that the list items not to be including the image tags that I used in a separate line:

1. Inside the Google Play Store for your project, navigate to `Settings` -> `API Access`:

    <img src="http://imgur.com/0n7ihzM.png"/>

I would see:

<ol>
<li>Inside the Google Play Store for your project, navigate to...
</ol>

<p><img src='http://imgur.com/0n7ihzM.png'/&amp></p&amp>


But if I added 4 spaces to the image tag, the problem went away:

1. Inside the Google Play Store for your project, navigate to `Settings` -> `API Access`:

        <img src="http://imgur.com/0n7ihzM.png"/>
 
Turns out that a change was made in Redcarpet v3.1.0 that changes the parsing behavior so that at least 4 spaces are needed for the line to be considered part of the list item.  It also is very likely that GitHub must be using an older version of this library, since this problem doesn't appear on native GitHub Wiki pages.   If GitHub should ever decide to upgrade to this new library, they're likely to cause their Wiki collection to experience similar problems!

https://github.com/vmg/redcarpet/commit/b7d5e017385a8ae35a594ff9535d31bd081ce973