AWS Cloudformation template for Counter Strike GO server

I spent an evening writing a cloudformation template for Counter Strike Global Offensive linux server. No, I don’t have a life. Yes, you will thank me next time you play with your friends and the laptop cannot handle more than 5 players. (AWS t2.micro handles 6 players easily, and you can always throw a c4.large at the problem which is still about $0.13/hr and handles, well, just about anything).

The template sets up a single EC2 instance of type t2.micro by default, uses the default VPC, and runs the server with “Arms Race” game in a free-for-all mode. Consult Valve’s documentataion page if you want to run other games or reconfigure the server in any way. The template also sets up a CNAME record pointing to the instance’s public DNS name, so comment the last section out if you don’t have a public hosted zone in your Route53.

Happy shooting!

iPhone 7 Plus and its Two Lenses

To some, Apple’s yesterday keynote wasn’t all that impressive. After all, the new iPhone 7 doesn’t look all that new, the new Apple Watch looks exactly like the old one, and minor improvements aside (water resistance, GPS for the watch, new processors), there wasn’t really anything impressive shown in San Francisco last night. Except one small detail—the camera(s) on the upcoming iPhone 7 Plus.

This is the photograph Apple showed during the keynote, initially leading everyone to believe it’s been taken with a “high-end camera”:

iphone-7plus-sample

only to later explain it’s been shot with the upcoming iPhone 7 Plus, which features two lenses—one wide-angle, and one tele—that are then used by iPhone’s software to infer the depth of field, and to create the bokeh effect. While far from perfect (there’s something wrong with how the face of the model is separated from the background), this, to me, is a major breakthrough in smartphone photography. As the technology matures, we will see the “bokeh software” improve, and the dual-lens technology perhaps applied to other areas (VR?), but most importantly it’ll render cameras obsolete, to most people at least.

I can’t wait for this day to come.

Hi, America

(I’m biased towards everything American, so despite a relatively US-critical tone, you may be offended by this post if you’re too European.)

I remember watching “The Cosby Show” with my parents in the nineties. It was a crazy time of massive political change in Poland, and my parents were always pointing at the fictional Huxtables as role models. Me and my father were even replicating Cliff Huxtable’s way of making chili, and we’d make tons of inside jokes that we’d always gladly explain to any guests we’d be having. We didn’t realize at that point how controversial The Cosby Show was in the 80s in the US. What was lost on Polish viewers was that the show’s depiction of black people was atypical to say the least. The Huxtable family wasn’t poor, hell, it wasn’t even middle class. A lawyer (a black woman!) and a senior obstetrician, raising a family of 5 in a fantastic brownstone in Brooklyn Heights—that’s how all well-educated Americans lived, right? We didn’t see the controversy, and missed out on some of the social commentary, but we still enjoyed Bill Cosby’s jokes, his colorful sweaters, his fictional family’s great parenting advice, etc. Of course not only the Huxtables were our role models, but the US was depicted as the promised land, which in the 90s it clearly was. They won the cold war, they became the sole superpower, Fukuyama announced “the end of history”—no one had any doubts.

Then at the break of the century, a new world begun. 9.11 happened, W. & co. took power,1 the 2008 banking crisis hit the world hard, the US middle class shrinked, Wall Street was occupied, and, as a proverbial nail to the coffin, they now tell me that Bill Cosby, my beloved Dr. Huxtable, is (allegedly) a sex offender. America of my childhood is gone for good, along with the post-cold-war Reagan-Thatcher world order formerly known as “new.”

Yet besides all that, there has never been a country I felt so emotionally strong about as the United States.

Continue reading “Hi, America”

Dehydration—a cautionary tale

I’ve been riding bikes for a very long time, and although I’ve had breaks, I can safely say I’ve been riding bicycles throughout my whole life. I am lucky to have never had any serious accidents or injuries while cycling, other than the occasional my-shoes-are-still-clipped-into-the-pedals thing,1 I’ve never been doored, I never smashed with my bike into things that generally don’t like being smashed into (that’s a lie; it’s just that injuries were never serious), and I was rear-ended by other bikers only on a few occasions.

Today I went for a quick ride. It was a short one, but since I only got a non-city bike a couple of weeks back,2 I’m still building up my strength and endurance, and, sadly, 50km-long rides are my standard for now. It’s a sunny Sunday in Munich, with a temperature of about 31°C (this is like 88°F, ‘Mericans), clear skies, and I decided to explore some trails around the Isar river. It was all going well, until I reached a part of the trail which was really more akin to a single track than a road of any sort. Riding there on my 32c tires, and climbing even small hills, and being in the proximity of a river which makes the climate hot-and-humid was very exhausting. When I reached the asphalt road and headed towards Neufahrn, I realized I’m running out of water. By the time I turned into Olympiastraße, I was getting a bit weak, and about 10kms from Munich I had to stop. Continue reading “Dehydration—a cautionary tale”

MFA tokens in your terminal

All the stuff described here I learned from my dear colleague Giulio. I’m sharing it here because it’s cool, and because I don’t think he’d share it anywhere other than our internal mailing list.

Do you use MFA a lot? Are you tired of reaching for your phone to check those codes on Google Authenticator app? Perhaps you’ve been logging to too many different AWS accounts because your work requires that? 😔 Here’s a couple paragraphs of advice that will ease your pain.

First, install oath-toolkit. On OS X you can get it with homebrew. Once it’s installed, you’d want to define a function for your shell, like this perhaps:

function mfa () {
   oathtool --base32 --totp "$(cat ~/.aws/$1.mfa)" ;
 }

This specifies an mfa alias which calls oathtool and expects one argument: name of a file (sans extension) inside your ~/.aws/ directory which contains a string that is the base for computing your time-based one-time passwords. To continue the AWS-based example, you can find the code in the AWS console while setting up a new virtual MFA device.

aws-mfa

Once you click on “Show secret key for manual configuration,” you’ll be presented with a 64-character string, which you’ll need to put in a ~/.aws/account-name.mfa file. After that, whenever prompted for the MFA token, type mfa account-name in your terminal.