I recently got a HackRF One software defined radio (SDR) to go along with my new Ham radio hobby. I’m new to all this, but one of the first things I noticed was that I was picking up a lot of radio frequency interference (RFI). I had purchased a RFI shield as part of the kit but had to install it myself. This post shows how I did it.
Opening the HackRF enclosure
The first challenge is opening the enclosure. To do this, first take the bolts and washers off of each of the SMA antenna connectors. Now, go in above one of the connectors with a little screwdriver (maybe put electrical tape over it) and start popping up the enclosure. Eventually you will pop it all up.
Installing the RF shield
Now we have to solder the RF shield onto the board. There’s a dotted line that shows where it goes.
Linux is an open-source operating system that you can download and install on your computer to complement (or even replace) your current operating system (Windows or MacOS). It started out when some guy wrote some code and gave it to the world community for free. It has become huge, and now provides the engine of Android phones and tablets, runs about 40% of the servers that make up the internet, and powers 97% of the world’s supercomputers. It’s a stunning success in the social open-source experiment.
For home use, it is just now ditching a reputation of being only for nerds, scientists, and hobbyists like me, with lots of headaches getting software and hardware working nicely with it. Really, I’ve been using it at home on my laptop since 2007 and it’s evolved to a point where I think it’s totally usable for most people. It also has a focus on privacy, security, and stability. Since the code is open (everyone can see and change how and why it works), there’s less mystery about what anyone is doing with your computer and more control to get it to do what you want. It was the speed and low-resource requirements that brought me to Linux originally, and it’s the quality and open philosophy that has made me a real proponent.
I was doing some speed tests with cython in Windows and started wondering what the import precedence was between py, pyc, and pyd files (not to mention pyo). So I did a simple little test with two files, test.py and test2.py. Test.py just had a print statement in it and test2 just imported test1 (so it would create the pyc). I compiled test.py with cython into test.pyd and then changed test.py to print something else.
Conclusion: The pyd file was always imported if it was present. If it wasn’t there, then the new print statement from the new test.py was printed out. I’m sure this is documented somewhere but I’m not sure where. The conclusion holds if there are “optimized” pyo files present as well.
So with all the recent revelations about everyone spying on everyone, I decided to look into what it would take to get fairly secure communications capabilities so my stuff wasn’t just in the open. I became a cryptography dilettante, and it is pretty fun. I have explained what I’ve learned to a few people so I figured I’d just write it all down here. It’s surprisingly easy and free to do.
Writing secure emails or transferring files securely
One basic thing you should be able to do securely is to send an email or file to someone that only they can open. To do this, you can use a free technology called Pretty Good Privacy, or PGP. Some nice free software that uses this is called the Gnu Privacy Guard. Go to GnuPG.org and download the relevant files. If you’re on Windows, get gpg4win (be sure to install GPA when it asks), Mac users can use GPGTools, and Linux users can just get GPG and GPA (Gnu Privacy Assistant) from the repos. Step 1 now is to generate your public/private key pair. These are basically just really large numbers that are intimately tied together in a way that if someone encrypts an email or file against your public key (which you will give to them), then only he/she who possesses the private key can decrypt it. So you publish your public key far and wide (here’s mine) and keep your private key very secret and safe (and backed up on a USB stored in your safe). Anyway, just go into the GPA program and click Keys->New Key. This will generate your keypair. Protect your private key with a strong password (10+ characters, no dictionary words. And don’t do capital letter + lower case letters + numbers + symbols in that order. Everyone does that!)
Now that you have a keypair, just right click it and say export key. This will export your public key to a file. Email the file or publish it online or whatever to anyone and everyone. When they send you an email or file, they will encrypt to this public key. Meanwhile, have your friends do the same and then import their keys that they send to you (keys->import key).
To actually encrypt, just go to Windows->clipboard and type some juicy secret. Then click encrypt and choose who you want to encrypt it to. Finally, just email them the ciphertext. It’s best to use a text-mode email by the way, so do that (it’s an option in gmail, etc.). They will get it and they can copy and paste it into their GPA and click decrypt, enter their secret password (which unlocks their private key), and they’re off. Phenomenal. Files can go the same way, just choose window->file manager instead of clipboard.
Alright! Super easy. If you use Thunderbird to read your email, you can use the Enigmail plugin that seamlessly encrypts for you. Nice! If you want a web-based email account that has tightly integrated PGP and no ads, try out hushmail.
There are a bunch of other cool things you can do with PGP like electronically sign your messages. This is something that you put at the end of an unencrypted (or encrypted) message that someone can “verify” against your public key. If no one has tampered with the message and you wrote it, then this verification proves that it was you who wrote the message. So cool.
Chatting and browsing the web anonymously and securely
So, great. Now, what if you’d like to chat with someone online and not have it be read? That’s your right. One pretty easy way to do it is through something called cryptocat. This is a Firefox extension that allows you to very easily have fairly secure chats. You COULD just click the link and install it, but you should really use The Onion Router too, which anonymizes your web traffic as well. That way, whatever you do online cannot be traced back to you because it hops through a secure set of encrypted layers on different volunteer servers first. So, FIRST go to https://www.torproject.org/ and install Tor and the Tor browser (there’s an android version too!). Then, open up the Tor Browser (which will automatically connect you to the Tor network), and then go to cryptocat and install the extension. Now you can open up a chat room and have a nice time chatting securely and anonymously. Excellent! You can use the Tor browser for anything else too.
Besides using Tor, you might want to stop using Google for many things. I started using DuckDuckGo, which doesn’t save your search history for hackers or rouge employees (or anyone else) to steal later. It’s not as good as google really, but it’s the principle that counts.
Security on your phone
If you have an Android phone, you can get these three cool apps that help with security. First is TextSecure, which allows you to exchange encrypted texts with anyone else who has TextSecure. It also stores your texts on your phone in an encrypted database, so if you lose your phone, no one’s reading your stuff. The same company makes RedPhone, which allows you to speak with anyone securely who has RedPhone. That’s totally sweet. I will admit that the voice quality in the case I used it in so far was mediocre. Finally, there’s Orbot, which is Tor for your phone, anonymizing your web traffic. Fun times.
Securely store files
If you want to keep a USB stick or a part of your hard drive that is encrypted (in case it gets stolen or something), the TrueCrypt tool is fantastic. It can even make a Hidden volume, where if you type a dummy password, dummy files show up but if you type the real password, the real files show up. And no one can prove the real files exist. That gives you what’s known as plausible deniability, a term coined by the CIA.
Encrypting with Truecrypt is different than with PGP because to send the file, the recipient would need to know the password. But how can you send the password securely? With PGP. So might as well just use PGP for the whole transfer.
If you’re a friend of mine who wants to try any of these technologies out with someone, just drop me a line and I’ll play along. I got a lot of this info from a reddit AMA, which you can read here.
Privacy is important, even if you have nothing to hide. Ok have a nice day!
Update: There’s a great collection of related information at this page.
My dad sold me a ’97 Jeep for $1 in 2006. It had originally come from Kentucky via my older sister. He sold it to me because I was about to drive from Michigan to Idaho and I’d need a reliable vehicle. The Jeep carried me across the country, taking me to the northwest for the first time, where I saw Yellowstone, the Tetons, and my first tumbleweed.
Once in Idaho, I took it hiking and camping every weekend. Into the mountains, through small rivers, out rock climbing. The one day I woke up in a tent surrounded by 10″ of snow on a mountainside, it delivered me to safety. Since then, the Jeep and I have been through a lot together and as a result I felt a surprisingly close connection with a completely inanimate object.
On August 15 2012, 6 years since it entered my life, I watched the Jeep get towed out of my parking garage by a wrecker, all up on a dolly and everything. It was totalled.
So what happened?
One nice August Saturday night, I threw a big party at my apartment. A “moving out soon” party, even though I wasn’t moving out for another month. I went to Costco to get supplies and unloaded lots of stuff from the Jeep and took it up. Everyone came and it was lots of fun. The next day, I slept in and eventually went somewhere late in the afternoon. I was going to motorcycle, but realized I couldn’t find the garage door clicker. I checked in the Jeep, where I realized I must have left it while unloading that big Costco load. It was then that I noticed something peculiar: the seats were reclined! Someone had been in my car! Oh well, no surprise, people get in this garage all the time and mess around in people’s cars. They had punched out my window once to steal a $10 item so since then I just left my doors unlocked. Obviously someone had just hung out for a while. I didn’t see the garage door opener. What I did find, however, was an unfamiliar cell phone. I took it up to my apartment. I manually overrode the garage door and went about my business.
Scene: Tuesday night. I come rolling in from work on the motorcycle, late for my soccer game. I have to change quickly and get going. As I’m heading out, I notice something funny with the Jeep. At closer look, the radio is ripped out! And the interior is all spray painted blue! The dashboard is completely blue. The center console is opened and everything in there is blue. The carpet is blue. The trim is blue. Everything’s blue. The radio isn’t stolen. No, it is just dangling by some wires. Blue wires. What’s worse is that the ignition is all chewed up and mangled. There’s no way to get a key in. Someone tried to jack a ’97 Jeep with 193k miles. Mother fucker.
So the cops come out and spend an hour dusting for fingerprints. They ask me a bunch of questions and I give them the cell phone. “Have you pissed anyone off recently? Like, did you maybe cut someone off without noticing?” No, I tell them. Not that I can think of. “Any psycho exes or anything?” Well, maybe… but not this psycho. I tell them that the video will tell all. Once I get a hold of the building guy and look at the videos, everything will become clear. They agree and head out.
As I’m pulling some stuff out to take upstairs, a neighbor comes down and I tell him the story. “Hey is the spray paint blue?” he asks. “Because there’s a blue can of spray paint under this car!” I call the cops right back and they come pick up the can to take it to the lab.
The next day, I got some video from the building guy. It showed a long-haired 40-year old guy buzzing everyone at the apartment at 3:30am Saturday night until someone let him in. He saunters into the lobby and props open the doors to the garage. Seconds later, a young couple emerges from the elevator (likely to see who they just buzzed in). They look around confusedly and point to the garage a few times and then close the doors. Now, the thing about my garage is that there has been a lot of trespassing, and so the building guy made it impossible to leave without a key. Surely that’s a fire code violation, but whatever. The effect was that this long-haired fellow was now locked in the garage.
The videos show him walking around a bit but not much more. I was disappointed and knew there must be more footage. I gave it to the cops anyway. The detective called and said, find more footage, this gives us nothing. I got the building guy to let me look for more details and I found them.
The guy had clearly slept in my car. He slept in there until about noon on Sunday! If only I had gone down earlier! Why was my party so good?! My neighbors even saw that there was a guy in there but didn’t know my number to call me and they were in a hurry so they just ran off without saying anything. He wakes up at noon and grabs a box of fluorescent lights and walks off. In doing so, we get a nice look at his face.
But then the good stuff happens. 3:30pm Tuesday, here he comes! Walking in all cool. He opens the passenger door and rummages around for a while, probably looking for that cell phone! He doesn’t find it and starts walking out. But wait! He turns around and heads over to where he got the lights from. Grabs a can of spray paint from the paint shed, and goes back to the car to do the damage. Apparently he wasn’t satisfied with the customer service of my Jeep.
Now that it was obvious that the guy had my clicker (my fault for leaving it in the car… so stupid!), I was able to convince the building to change the code on the gate. Since my window had been punched earlier, I had comprehensive insurance on that old car (unheard of for ~200k miles!) so I got way more for the jeep than I could ever have sold it for. The detective is actually on the case and has some leads.
In fact, they’ve positively identified the guy with fingerprints on the spray paint can and are prosecuting on behalf of the insurance company. Justice will be served. I’m only a little worried that this vengeful bastard will be even more vengeful after the prosecution starts! Conveniently I’m moving in like a week.
Meanwhile I joined the rest of my Seattle brethren and got, of all things, a Subaru. It’s no Jeep, that’s for sure. And women have already ridiculed me: “Why don’t you just put a car seat in there too, hahaha!” But I just couldn’t justify the hilariously low gas mileage of the Xtera, which was really the only SUV short enough to fit a motorcycle in the same parking spot as it (essential in the city: Jeeps are incredibly short!). This thing will get me to the trail heads and the ski hill, and to be perfectly honest I haven’t used the Jeep for rock crawling since ’07.
Moral of the story: lock your doors, don’t leave garage door clickers in your car, don’t buzz people in your apartment at 3:30am who you don’t know, leave arbitrary cell phones where they are, and have comprehensive insurance.
The good new is, the only valuable things in the jeep were left untouched: the flux capacitor and the subwoofer my friend Karl gave me in 2002.
The USA is divided in many ways. There are strongly-held dichotomies in all arenas, from politics to sports. People identify with liberals, conservatives, city people, country people, whites, blacks, red sox fans, yankees fans, geeks, jocks, the rich, the poor, kids, adults, skinny people, fat people, fashionistas, involved people, apathetic people, 420-friendly people, 420-unfriendly people, singles, couples, etc. And many of these identity distinctions are somewhat surprisingly dear to those who hold them, often associated with instantaneous judgment of any opposing groups. Liberal city people don’t respectfully disagree with their opposition, they truly think that they are pure idiots! Particular religious people don’t turn the other cheek, they declare war on contraception! And it’s most obvious of all in sports. “Those a**holes on the other team are so evil and horrible that I just can’t stand it!” I actually know people who pack extra cans of gas when they drive through Ohio so as to not “support their economy” for this reason. (Don’t even mention the ref when he makes a call against my team! Complete imbecile!)
Within these groups, confirmation bias runs rampant. People surround themselves with like-minded peers, further pushing productive discourse into a neglected and forgotten corner. “You’re either with us, or you’re against us! And there’s no in-between,” we say.
I was having a typical conversation at work, discussing life after the next apocalyptic event. It occurred to me as we discussed our plans that the first few days after rule of law falls would be the scariest. People rioting through the streets, looking everything in sight, killing on a whim to get a pretzel or something; every man for himself. During this time, I plan to just hunker down with some PB&J and wait out the craziness. But after a few days, somewhat structured neighborhood alliances would form, enabling me to have a bit of trust in those around me. Instead of every man for himself, it’s now us vs. them. And in that situation, I’m feeling much safer. I can cooperate with people again and defend against the neighboring block when they decide to invade again, and so on. Hooray.
Snapping out of this dark fantasy, and thinking instead about our less dire identity complexes, I came up with the following hypothesis.
Humans need safety to survive, by definition. Community groups have historically offered a bit of safety against the roving hoards. As old structures (such as neighborhoods, small towns, and churches) decrease in dominance in the modern US, there is an equal and opposite force diminishing community. Naturally, we have a subconscious urge to regain some community, so we do it the old way, but in lieu of “real” danger, we fabricate enemies through fairly trivial mechanisms (think sports) and in doing so, recreate the good old feeling of being part of “us” where they, those bastards, are part of “them.”
If this is the case, then the natural antidote to cure our fabricated identity wars is to bring community back. Things like Facebook show how much we want it, but they are still pretty empty in terms of how well they satisfy our instinctual quest for safety. Everybody knows there’s something ridiculous about how pigeon-holed we have made ourselves, but we’re all in a kind of daze as to figuring out what to do with our ceaseless and unproductive arguing.
Others have argued similar points, but not quite for this reason. A book review I read in New Scientist of this book explained that this author claims that secular society needs religious institutions to be happy. There may be some truth to that, but trying to promote these ideas coming from an atheist group is just fanning the flames. It’d be nice to get some easy community going that is inclusive to both religious people and secular people. Maybe after cookies-and-punch hour we could all get together on Sunday afternoons and have community members give little talks about things they’re good at, or a news story they’ve been following closely. There could be like 10 rooms, and you can go from one to the other depending on your interests. The mechanics could host a “learn to change your own tire day.” If we could somehow institutionalize these kinds of gatherings, thereby giving people a little community, I think the ridiculous arguing would slow down, and we might feel better about ourselves.
Just FYI, I was having a problem with ipython 0.12 running within Console, where pressing Ctrl-C to cancel an operation in a Python would actually just close the whole ipython window! It was horrible, since before I reinstalled everything it wouldn’t do that. Anyway, there’s an email chain talking about this here, but it’s irrelevant to this particular problem, since I’m using mainline (non-dev repo) versions and don’t know what an ETS is.
Thankfully, there’s a very simple solution (assuming you made my same mistake). Rather than setting the console tab to C:python27scriptsipython.exe, instead set it to C:python27python.exe C:python27scriptsipython-script.py and Ctrl+C will give a KeyboardInterrupt and leave you in ipython, just like the good old days!
Continuing the journey, the folks at work upgraded me to 64-bit Windows 7 and the Trilinos folks updated to 10.10. Needless to say, I had to rebuild. I can’t definitively say which of these steps is necessary but I can tell you that if you follow them, you can compile a C++ python extension that uses many aspects of Trilinos on this system. And not just a few packages from Trilinos either. In fact, I’m currently using all of the following:
Epetra
AztecOO
Anasazi
Teuchos
epetraext
Amesos
To do this, first run the trilinos cmake system without shared libraries. Then build. This builds things like epetra.lib. Now, go back and turn on shared libraries and build again, this time with shared libraries turned on. This builds the dlls, which I believe are required to build a python extension. If one of the ones you needs fails, just go in to Visual Studio 2008 and open up the Trilinos solution. Right click the project. Change from a static library to a dynamic librray. Change Use of MFC to “Use MFC if a Shared DLL.” Change Use of ATL to “Dynamic Link to ATL.” The rebuild the package. The DLL should be created.
Once all the static and shared libraries are built, I didn’t even mess with environmental variables (being a grad student and all) so I just copied them all into the build directory of my Python extension. On import, it worked just fine. Amazing!
I have yet to try linking to MSMPI and running large reactor problems on Microsoft HPC but that will be coming someday.
At Smashputt 2012 last night, there was a random old Schwinn exercise bike like my mom use to have. I made Kylie and Caroline ride it like my sister and I used to: one person on each pedal!
Here’s a really dark video that kind of shows how much fun it was
Continuing my python extension project, I’ve now successfully built a toy python 2.7 extension in C++ that uses the Epetra package from Trilinos 10.8. I’ve built it on Ubuntu 11.10 (with gcc) and on Windows XP (with Visual Studio 2008) using distutils. It’s a bit of a hack, but it works and is a path forward for me.
I started with Linux, because I figured it would be easier. I learned a few things along the way. First, you have to have built Trilinos with shared libraries enabled. This is required for how Python handles things, I guess, and is made clear under the heading “Shared Libraries” in this file. The PyTrilinos package (which is effectively a professional set of python-trilinos extensions, btw. I needed a custom one!) needs them as well. So run your cmake-gui and check the shared libraries button. Besides the libepetra.a in the build folder, you’ll now also find a libepetra.so. In Windows, you’ll get >500 errors if you compile all of trilinos with shared libraries, but Epetra at least worked. Continue reading building a python extension with trilinos on linux and windows
I’m just embarking on a historic journey to learn a bit about the Trilinos math library. To get started, I’ve gone through the hands-on tutorial a bit and after a few tries, I’ve gotten something compiled.
Trilinos 10.4 is available in the repositories for Ubuntu (11.10 confirmed). But Trilinos 10.8 is out now, so I had to build my own. Their instructions with CMAKE were quite good and the build process didn’t have too many hiccups. I found that the cmake gui is the way to go. Make sure you enable Didasko (the tutorial) in the cmake gui. When you do this, a few more Didasko options show up so you have to go enable those too. Continue reading my experience compiling against Trilinos on Ubuntu
Here’s a random one. I’ve had this talking electronic chess board since 1994. It’s called the Sharper Image Design Talking Chess Companion. Model SM 470. It’s awesome and wonderful and I can’t find any commentary on it on the internet. Therefore, this. I’ve taken the attached video showing Chester in all his glory, and with all of his loving phrases. Such as:
Hi! I’m Chester. How about a nice game of chess?
Sure you’re playing better but your taking more time than me.
Now I’ve got you!
How about a draw?
Many good times hanging out with old Chester. They did a great job putting in tonality into his commentary. It’s really like playing with another person. I only wish the random number generator had him do other openings more often. I’ve never really used the tournament openings mode, but I’m kind of curious. I wish I still had the manual. Anyway, the best part is that I know that my 4th-grade self is better at chess than my current self because I used to be able to easily beat Chester on a higher level than I can now.
I just built ERANOS 2.1 reactor analysis suite from France on a 64-bit linux workstation with Red Hat 7. It wasn’t that bad, as the CEA has done a great job at automating the installation process. I’ll briefly discuss how things went.
First of all, don’t cd into the UTILS folder and run Install. You have to do as it says and run UTILS/Install if it doesn’t work the first time. Also as it says, it’s smart to copy all the library disks over before loading the code DVD. Continue reading Installing ERANOS 2.1 on a 64-bit linux workstation
If you use REBUS to analyze your nuclear reactors, and you use a lot of regions, you may be interested in page 13 of this pdf. You can change one line of the source code and the point where it says: “HMG4C CALLED AFTER NEUTRONICS TO UPDATE COMPXS” will fly by instead of sitting there for a very long time. This is a huge fix that ANL knows about and fixed internally but didn’t re-release to RSICC. I think it only affects REBUS-PC, and that REBUS-3 is OK. Enjoy!
This is like my favorite rant. You know how legislation is targeting renewable energy? Well that’s a bad idea. Back in my day, people used the word “sustainable” to describe energy sources and lifestyles that were just that — they could continue for a very long time without us running out of resources, killing everyone, etc. Well now renewable has gained favor and is the obvious way to go for everyone who doesn’t know any better. At first glance, most renewable things seem sustainable. But that’s not necessarily the case! Wind and Solar are renewable, but are we considering the quantity of rare earths needed to get the current technologies up to significant levels? Not necessarily. (BTW, solar thermal is way better than solar photovoltaics (solar panels)). And just to make the point more clear, consider the following renewable energy sources:
Trees
Whale Blubber
Not very sustainable, either of those.
Another beef is that people use renewable to exclude nuclear power. Well you can’t do that anymore.
Nuclear Energy is now Renewable
Typically nuclear is not considered renewable. But the Japanese have recently demonstrated that they can pull Uranium from the sea for something like $100/kg. And guess what? Lowell Wood has recently pointed out that plate tectonics move the earth’s crust at a rate that replenishes the uranium in sea water faster than we could ever use it. So that means Uranium is now renewable. So HA.
Keep in mind that renewable doesn’t mean sustainable. In typical reactors only 5% or so of the uranium is burned. We’ll have to do better. Consider high burnup reactors like fast breeders, TWRs, LFTRs, etc.
I’ve had an ongoing battle with staying organized. It never went anywhere — I tried a lot of different notes-taking programs and stuff, and even started a blog to try to do it. Well the other day, I came up with an idea that I think will work really well. I told it to a couple people and they said
that’s a really good idea, I think I’ll try it too.
It’s really simple too. Just take a thin 3-ring binder (1.5″ or whatever) and put a bunch of printer paper in it (you have to punch the holes). Now, when you get a task to do, write it on top of a piece of paper, and write the date and a 1 with a circle around it. Write down the task and your basic plan of attack. As you do the task, write down what you did, what problems you had, what solutions you had, and where you left off. If you need more pages, just add another page and put a 2 with a circle around it. Once you get a bunch of tasks going on, this method is really useful because you can see exactly what you did and why you did it. Once the task is finished, staple all the pages and file it in its category in a file cabinet or something.
Not only has this kept me more organized, it helps when I want to stop one task and do something else for a while. I just flip through until I see one that isn’t finished.
Marriages should expire after 5 years. If you want to renew your marriage, you should have to fill out huge amounts of pain-in-the-ass paperwork. It shouldn’t be the other way around.
Want to stay married?
Nah.
Haha. It’s genius. They only last 7 years on average anyway. Why keep people unnecessarily miserable?
And the paperwork could be stuff like, what’s their birthday? What do you think they think is the most annoying thing about you? It could be therapeutic to go through anyway.
iPython is a very nice way to fiddle around with Python interactively. Most beginners just use IDLE for this, since it comes with Python. But as you get to plotting stuff, you’ll find that IDLE just doesn’t cut it (it freezes every time you plot anything). So you try the regular python command line (on the black screen) but get frustrated that you can’t change directories or use tabbed completion or anything. You hear about ipython and try to use it but it’s not very obvious. Well all you have to do is make a shortcut and you’ll be off and running.By the way, if you had started on Linux in the first place, you wouldn’t have to deal with all this! Anyway, on Windows,
0. Make sure you have Python installed with matplotlib and numpy modules.
1. Get ipython from http://ipython.scipy.org/ install it from the download page for your version of python
2. Make a shortcut to python.exe and then right click it and hit properties to change where it points to to:
Yay. Now you have ipython on windows with matplotlib interactive capabilities! I suggest having your text editor open in one window and this ipython window in the other. Edit your code, save it, and then type “run mycode.py” to run it in the interpreter.