Wednesday, May 25, 2011

Very crude password generation

Generates 25 passwords which alternate between the left and right hands for each character, have alphanumerical plus symbols and never require holding down shift. Coded while playing Super Smash Brawl at 3am so I bet there's a million horrible things about it.

import random

alpha_left = ['r', 'q', 'w', 'e', 'r', 't', 'a', 's', 'd', 'f', 'g', 'z', 'x', 'c', 'v', 'b']
num_left = ['1', '2', '3', '4', '5', '6']
symbols_left = ['`']
alpha_right = ['j', 'k', 'l', 'n', 'm', 'h', 'y', 'u', 'o', 'i', 'p']
num_right = ['7', '8', '9', '0']
symbols_right = [';', "'", '[', ']', '.', ',', '/', '-', '=', '\\']

left = [alpha_left, num_left, symbols_left]
right = [alpha_right, num_right, symbols_right]

def gen_pw ():
passwd = ""

for i in range (8):
if i % 2:
cata = left[random.randrange (3)]
else:
cata = right[random.randrange (3)]
passwd += cata[random.randrange (len (cata))]

return passwd

def check_pw (p):
has = [False, False, False]

for c in alpha_left:
if c in p:
has[0] = True
for c in num_left:
if c in p:
has[1] = True
for c in symbols_left:
if c in p:
has[2] = True
for c in alpha_right:
if c in p:
has[0] = True
for c in num_right:
if c in p:
has[2] = True
for c in sym1ols_right:
if c in p:
has[2] = True

if False in has:
return None
else:
return p

pwlist = []
while len (pwlist) < 25:
tmp_pw = check_pw (gen_pw ())
if tmp_pw:
pwlist.append (tmp_pw)

print pwlist

Wednesday, May 11, 2011

Door + electronics

So far it's just a couple status LEDs (door open/closed and a "doorbell") and sketchy wires but I'm planning on cleaning it up once I have time.
All the resistor values are completely arbitrary, I grabbed them at random and they work. If I thought it through I could probably get the LEDs a little brighter but it doesn't matter too much. The only important things are that the resistors are large enough so the LEDs don't burn out and R2 has to be small enough to pull enough of the current so the LED doesn't turn on.

Left LED is red, right LED is green
Bare wires, when you short them together the red LED turns on. I'm planning on putting a nicer button here
Aluminum tape on the door and weather stripping (convenient for sealing a door and guaranteeing good contact!) with wires duct taped on each contact, since only the non-sticky side of aluminum tape is conductive.
All of it together:
Yay!

EDIT: As several people have pointed out, it would be smarter to do the door switch with a transistor. The reason I didn't was because the circuit got about a minute of thought (if that) and I just grabbed a few parts near me.

Electric scooter

Mid February, I decided to build an electric scooter. Unfortunately I didn't write up what I was thinking along the build, but I took a lot of pictures. I finished the majority of the mechanical work (minus mounting the motor and I still don't have a brake) in late March and have been using it as a kick scooter since then. When I'm done, it will have a hub motor I built, a motor controller I bought, and as many batteries as I can possibly back into the base. I'm hoping for a 10 mile range but I have no idea how efficient the motor will be yet.

Pictures and write-ups of some of the choices I made and the ways I built things coming soon, finals week is coming up so I'm short on time.