Category: Geek

$20 Android Dev Phone

October 6, 2015 » Geek

I’ve been doing a bit of Android dev work lately, just tinkering mostly, and I needed hardware to test on.

Following the advice of local Android guru Mark, I just went to Amazon and bought something cheap running at least 4.0. What I ended up with was a Verizon prepaid LG Optimus Exceed 2

The $20 Dev Phone

The hardware is decent, especially for a $20 phone. I’ve not used it a ton yet, but I would say this would almost be a tolerable daily use phone. Camera sucks, but who cares.

Here’s how I got it set up.

Skip Activation

Right after boot, you can skip activation with this sequence:

  1. Volume Up
  2. Volume Down
  3. Back Button
  4. Home Button

Source: XDA

Developer Mode

Go to Settings > General > About Phone > Software Information then tap Build Number seven times.

You should find a Developer Options in your main settings now.

There’s one more step though on OS X. When connecting to USB, you only trigger debug mode by choosing Internet Connection > Ethernet for the USB connection method.

Use ethernet.

Source: Stack Overflow

Root It

The internet would have you believe that rooting your Optimus Exceed 2 is super easy. For me, it was not. There is a one-click guide but I had to fall back on the original set of scripts to make it work, which took a couple tries.

But it worked!

Look! SuperSu!

Conclusion

I’ve not actually used it for a lot of development yet, but I’ve loaded up some apps with the Play store and it’s reasonably responsive. I like it.

Tags:

You Should Be Using Redis

September 10, 2015 » Geek

Today I gave a talk at HDC15 entitled, You Should Be Using Redis

It covered all the basic data structures and many commands, as well as replication, sentinel and cluster. I had a great time even though I was terrified.

Unfortunately, near the end of my talk Keynote froze and I lost the recording of the slideshow and audio, so I don’t have that to share.

Instead, here are the slides, as well as slides+presenter notes. Hopefully my notes don’t contain anything embarrassing.

You Should Be Using Redis
Download Slides | Download Notes

Here are some links I used to create this talk;

Thanks for having me HDC! If anyone else in Omaha/Lincoln wants to hear a ~45 minute talk about Redis, let me know.

ಠ_ಠ Keyboard Button

August 26, 2015 » Geek

The other day I was looking at keyboard stuff and decided to order some arrow keycaps for my keyboard. They also had one with the look of disapproval face on it, so I bought that too.

I popped it onto my Print Screen key, which maps to F13 in OS X, then I wrote an Automator service to copy/paste ಠ_ಠ when F13 was pressed.

I have never written AppleScript before, so the result was kind of wonky. It worked in some inputs, but not in others.

Then, Alex pointed out that Alfred workflows can be triggered by global hotkeys. What can’t Alfred do?

A quick workflow later and my ಠ_ಠ key was working like a dream.

ಠ_ಠ Workflow

You can grab the workflow here, if you want. I bet you could figure it out for yourself too though.

ಠ_ಠ

Updating S3 CORS With Boto

November 17, 2014 » Geek

Sometimes you don’t have access to the S3 console, but you do have keys for a bucket. If you need to change CORS for that bucket, it turns out you can. Boto has API methods for this.

Tags: , , , ,

Automatic MySQL Slow Query Log Emails

October 10, 2014 » Geek

Something we try to do regularly at Pack is to check for slow queries.

We do this when introducing new features and schema changes, but we also try to do it occasionally to look for anything that may have slipped through, or become more of an issue as usage patterns change.

To make this a more regular occurrence, I decided to automate it.

The first thing that needed to be handled was enabling and disabling the slow query log. I don’t want it to run all the time, because eventually it will eat up too much disk, and there has to be overhead to calculating and saving that data.

To turn it on and off, I created a limited privilege user on the server called “slow_log”. The commands needed to turn on the slow query log are SET GLOBAL and FLUSH SLOW LOGS. Looking at the MySQL documentation, the privileges needed for those commands are RELOAD and SUPER.

Once that user was in place, I created two shell scripts. The first just logs into MySQL and turns on slow query logging.

The second script turns slow query logging off, then it processes the slow query log with request-log-analyzer and pt-query-digest. Lastly it emails the output of those tools to me.

Finally, I added a cron job to run the first script at the beginning of the day once a month, and another to run the second at the end of the day once a month. That way, once a month, I get an email with slow query logs to look over and try to improve.

As a note, using a subshell to generate the body of the command is something I hadn’t seen before and came across while looking for uuencode usage. It’s a nice trick.

So. What did I screw up horribly?