21 December 2014

Riecoin and OS X

The Riecoin website (http://riecoin.org) suggests that Mac binary works for OS X. Unfortunately it doesn't appear to work on either OS X 10.9 Mavericks or 10.10 Yosemite: if you double click the Riecoin-Qt.app in the disk image, OS X complains that it "may be damaged or incomplete." The trick is to cd into the Riecoin-Qt.app folder/Contents/MacOS folder and execute the Riecoin-Qt command line app from the terminal. VoilĂ !

18 December 2014

Status dump, Dec 4 - Dec 18

About two weeks' worth of statii:

`good enough` does not get ferraris ;__;
This one has quite a comprehensive backstory on mediocrity and niche contests/organizations that I may or may not get around to posting.

"what's life without a ferrari? very 99.9% :("
I think I thought about this when I discovered the site www.jamesedition.com.

"…intended owner is going through a divorce and can’t take delivery [of a $300k Lamborghini]." :(((
Saddest work email I've seen yet.

"Not too many bookworm types in fast Italian cars."
Found while leisurely reading www.ferrarichat.com.

25 November 2014

On Nice Things

A comment that resonated with me deeply while reading FerrariChat:
I am by nature an introvert. I have a difficult time with the attention my 360 garners. I live in SW Michigan so there isn't a lot of serious wealth (not that I'm seriously wealthy by any means) and a Ferrari really sticks out. I dread gas stations. But I have a lot for anything engineered with such beauty and efficiency. Hence my attraction to Swiss watches as well. Just interests I have that I don't particularly care to share with others (I am not complaining and I would never snub anyone interested in my car; it just makes me uncomfortable). --campbell360

07 September 2014

Get the caller to admit he got the wrong number

A friend from college usually answers to phone with a bogus greeting whenever he gets called, since most of his calls are from unknown numbers. I've been meaning to try it out, and got the perfect chance to do so yesterday.

Some unknown number calls my phone. I pick up and clearly don't recognize the caller's voice. He was looking for a "Christopher"; I couldn't hear clearly.

"Cambridge animal control, how may I help you?" I responded.

"Sorry, who is this?" He sounded surprised.

"Cambridge animal control." I reiterated.

"Oh sorry, I got the wrong number." *click*

Success!

24 August 2014

That was an earthquake?

My complex's management alerted us earlier this week that contractors would be install solar panels. Since we live on the topmost floor, we hear every footstep the staff makes. Not only that, but also our ceiling mounted potholder (and pots) rattle violently at each disturbance. So it was no surprise that I heard rattles and felt the building shaking in the middle of the night; solar panels were being installed!

Wait a minute…

09 August 2014

Being a Real Person®, Part I of Many

It sure has been a while since I've blogged (about anything!), so this post will be an end to such hiatus. I have a bunch of drafts on various technical shenanigans, but haven't found time to write in the middle of relocating.

Moving was pretty darn stressful. Because I am a Terrible Person and procrastinated, I felt pressured to liquidate a bunch of computer parts at the last minute. I was not pleased that I had to make aggressive price cuts to increase liquidity. At least I sold all of my GPUs I bought for mining, because those would have been worthless now. Having movers to repack and ship was convenient, so everything settled down after they came and did their thing.

My main hobby is taking care of Bud, my Porsche 911, who I bought near the beginning of my senior year :3 (yeah internship money~~~) [1] Driving Bud is a huge blast; I'm getting into advanced stick shift techniques, such as rev-matching my downshifts. I'm still no good at heel-toeing, but that's okay since I'm still learning! One piece of advice I got was to practice by nudging the throttle at a stop light while my foot is on the brake.

I should note that babying Bud is pretty expensive: I got Bud waxed and washed upon delivery ($120) and then a wash and leather conditioning two months later ($80). Most recently B&R Racing did an outstanding job repairing the curbed wheel (completely my fault for being a n00b); that'll be $350 please. On my list of future repairs is replacing the alternator, since the car is really slow to crank from a warm engine, and that's $1500 (thankfully including labor and tax). That said, slow starts aren't a big deal now that I don't stall the car at every other red light.

Carrying responsibilities of a Real Person seems not too hard for now. I don't have much of a life outside of work, which is quite relaxing, so I have plenty of time to do chores and run errands. Because driving Bud is such a blast, I look forward to commuting and getting grocery and shuttling friends to and from the airport and what not.

That said, I do avoid doing some chores, like vacuuming, which I've delegated to the wonderful Roomba. It's not only convenient, but also highly amusing to watch.

On being a woman in CS/technology/STEM, I figured I'll comment a bit since this is much of the rage in the tech industry right now. I have yet to be discriminated against (ever since my middle school misfortunes -- and that was by my female peers). Maybe I'm just socially inept and don't know when my colleagues/classmates/friends are disrespectful toward me or my female peers. There definitely are way fewer females in the teams I'm on and work with, which might be solved by targeted recruiting at women in CS/tech groups, getting and retaining younger females (middle/high school aged) into STEM, reworking social constructs, etc etc.

On that note, as a former USACO (competitive programming) participant, I'm disappointed by the lack of females in the upper divisions (silver, gold, and camp, but camp really is not relevant at this stage). [2] The competitive math scene is better, probably because of more participation and exposure at schools.

[1] My parents paid for my MIT tuition (~3.75 years since I took a light load last term). I will hopefully continue this tradition and hopefully buy my parents a Ferrari someday :3 As for internships, I did something every summer (3x) and every January (4x). All in all, I had a decent surplus after buying the 911. Do math! Make informed decisions!

[2] That said, this year has been extraordinary in that a girl qualified for the invitational camp, but sadly did not represent the US at the international level. This rare event happens once several years; hell, qualifying for the gold division (which I did) isn't even a yearly occurrence. Perhaps I should start mailing high school teachers about it.

25 April 2014

Go-Kart Revival: Part I

So about that go-kart I was building...

Continuing where I left off, I needed to wire up the motor controllers with the motor, throttle, and mains (power). It was pretty simple; just read the wiring diagram in the motor controller manual and connect wires where appropriate.


My work layout on the EE bench is pretty simple. I have a 30V power supply powering the motor controller (the silver brick), which is connected to the three phases of the motor, hall sensor, and the throttle (not pictured here). The red multimeter is for testing the various voltages on the motor controller wires to make sure none of the wires are broken. One of my friends had this bug, and it took her a while to figure out!


I also have some helping hands, which are the silver arms holding wires over the table. The throttle is near the bottom right of the picture, below the blue strippers. The super awesome soldering station is a Weller industrial soldering station.


It took a while for me to figure out that both power inputs to the motor controller need to be 18+V, something the manual doesn't say. Thanks Charles!


There are two red LEDs (well one has a red housing and the other has a clear housing) amid the wires which indicate the motor controller status. Here, the clear LED should be solid red and the red LED off.


Here's a photo of hall sensor jiggling, with a great writeup by Charles. The goal is to figure out which permutation of phases I should connect the motor to the controller. If the motor and controller are not matched properly, then the motor will not spin. There are 3! = 6 permutations, but luckily I found the right pairing on my second try.

However, one motor has to spin CW and the other CCW since the motors are mounted opposing each other. To make the motor spin the other way, you have to cyclically shift the three phases. There are only two distinct shifts, and I was pretty happy that I got the motor spinning on my second try.

There's more to come! What remains is hooking up the motors to the chassis, installing the chains, and refurbishing the rest of the vehicle as necessary to get it running!

15 April 2014

Math For America Poker Tournament

Saw this posted somewhere on the internet. Browsed the organizers list and previous winners. Many names were familiar, not only from books, but also from previous correspondence. It's a small world.

11 March 2014

Cryptocurrency Mining

This post is a walk down memory lane of the past two months of mining.

Smashing 4 GPUs together doesn't work well at all without hardcore ducting. Turns out that this setup actually mines slower than 3 GPUs and a fan on top.
It turns out that the limiting factor is power density. I wasn't going to buy faster GPUs because of a poorer hashrate per dollar, so I needed to get more PCIe slots. I bought some dumb nodes to get my other pile of GPUs up, but after this fan cutting my hand (and losing a blade in the process), I resigned.
Pile of unused GPUs. These sat unused for the duration of mining.

My two former miners:


tl;dr Making money is hard.

08 January 2014

Abusing the C Preprocessor

On a whim, I thought of this idea after reading Cory Li's article on bytecode hacking for Battlecode, MIT's premier Independent Activities Period competition, and after reading some code of his bot, which won Battlecode 2012. Optimized code gets real messy real fast, so wouldn't it be nice if it could be (just a little) easier to write?

The C and sibling languages have a wonderful feature called preprocessing. This feature allows one to insert snippets of text character for character into another file, so as to save time and space writing redundant code. The most prevalent use of the preprocessor is for including header files:

#include <stdio.h>

int
main()
{
    printf("%s\n", "Hello, world!");
    return 0;
}

Another use of the preprocessor is to define macros. For example, in competitive programming, one iterates from 0 (inclusive) to N (exclusive) reasonably often, so why spend the time to type

for (int i = 0; i < N; ++i)
{
   // ...
}

when it can be compressed to

F(i, N)
{
   // ...
}

all with the simple macro

#define F(i, N) for (int i = 0; i < N; ++i)

Now it's great that C offers this, but what about languages that don't, such as Java? Is there a way to make the C preprocessor do this for us?

The answer, unsurprisingly, is yes! We can use cpp (that's c preprocessor)

cpp test.c

to find all the macros in our code, as defined by #define, replaces them with the value with which they are defined, and removes the #define. However, it leaves some junk in the code, namely some lines at the beginning of the files starting with #, so we have to remove those before giving the preprocessed file to javac.

So how do we put all of this together? We first write C-ified Java code Test.cjava with our macro

import java.util.*;

#define F(i, N) for (int i = 0; i < N; ++i)

public class Test {
    public static void main(String[] args) {
        F(i, 5) {
            System.out.println(i);
        }
        System.exit(0);
    }
}

and preprocess it with cpp to generate the almost-legitimate Java code. We can strip the aforementioned lines that start with # by passing the output of cpp to sed with a regex that deletes any line that starts with # and redirect the sanitized output to our desired Java file

cpp Test.cjava | sed '/^#/d' > Test.java

Finally, we compile Test.java and run it with java Test, which will produce the desired output

0
1
2
3
4