Many moons ago, I wrote a tutorial on how to set up an internet gateway on a Banana Pi, complete with DHCP, DNS, VPN, firewall and ad-blocking. It works well, I still use one today, and have even taken it with me on a few long backpacking trips. However, I worry about it being a bit fragile, and fear the day when an over-zealous customs officer decides it looks like something that could trigger a bomb , so I was overjoyed when I finally found my holy grail: something that does all of the above, in the form factor of a USB thumb drive.
GL-iNet's GL-USB-150 costs around USD 30, and comes with almost everything I need to get online when I'm on the road. This tutorial will be much shorter than the previous one, because nearly everything is already set up and ready to go
Plug it in, give it 30 or 40 seconds to start up, then open a browser and go to http://192.168.8.1. To login, the default password is goodlife; once you're in, change this under More Settings/Admin Password.
It runs a DHCP server, and your computer will have already been assigned an IP address in the 192.168.8.xxx range.
Go to the Internet page, click on the Scan link, then connect to a WiFi network.
Open another browser window, and confirm that you're online.
Configuring the VPN
Go to the Management tab in the VPN/OpenVPN Client page, and upload your VPN configurations. This will typically be a ZIP of a bunch of .ovpn files, but if you have them, you will also need to include the .crt and/or .pem files.
Unfortunately, the stock firmware has a bug that prevents the ZIP file from being processed correctly, so you will need to upgrade the firmware first. Get the latest version from hereVersion 3.026 worked for me., then install it via the Upgrade page.
Once the VPN configurations have been installed, you will be able to select which one to use from the VPN/OpenVPN Client page. Check your IP address to confirm that you are going through the VPN.
To install additional software, go to the More Settings/Advanced page, and in the new browser window that opens, go to System/Software and update the package listsThis doesn't seem to persist after a reboot, so you have to remember to do this every time .
I installed the following packages:
openssh-sftp-server (so that I can scp files in and out)
openssh-client (for a version of ssh that allows forwarding)
coreutils (for GNU tools)
bind-dig (for dig)
mtr (a handy network monitoring tool)
To change your default shell to bash, update /etc/passwd.
The only down-side to this device: while you can just about install a minimal version of Python, the disk is so small, there won't be any room for anything else
The only thing missing from this device is an ad-blocker. Since it uses dnsmasq for DNS, rather than bind as the Banana Pi does, the process is slightly different, but not much. Here's the script that I use:
# This script downloads blacklisted ad servers and updates dnsmasq to block them.
# The following line needs to be added to /etc/dnsmasq.conf:
echo "Downloading the DNS blacklist..."
wget -O "$TMP_FNAME" "$BLACKLIST_URL"
if [ $? -ne 0 ] ; then exit 1 ; fi
# fixup the entries so that they return "NX Domain"
echo "Updating the DNS blacklist..."
sed -i 's/address/server/g;s/127.0.0.1//g' "$TMP_FNAME"
# install the new DNS blacklist
echo "Installing the DNS blacklist..."
echo " $TMP_FNAME => $BLACKLIST_FNAME"
mv "$TMP_FNAME" "$BLACKLIST_FNAME"
echo "Restarting dnsmasq..."
echo "All done."
The DNS blacklist is downloaded to a temp file, fixed up and then transferred to /root/dns-blacklist. You will need to tell dnsmasq to load this file by adding the following line to /etc/dnsmasq.conf:
This script can be configured to run periodically, or just run it manually every now and then.
There doesn't seem to be any way to shut down the device cleanly. I'm guessing it's been designed so that people can just pull the thing out of the USB port, but this really irks the sysadmin in me , so to shutdown cleanly, type the following in the console:
The green LED light stays on, but the device will shutdown.
I can't remember exactly how, but I stumbled on these a few days ago, and I simply had to order a bundle, and they just arrived today
If you don't understand what it means, vi is a text editor for developers that is, while extremely powerful, notoriously difficult to learn and use, and :wq is what you have to type in to save your file and exit - ":" puts you into "command" mode, "w" writes the file out, and then "q" to quit.
This is, of course, not particularly intuitive and it's a rite of passage for Linux newbies to get insanely frustrated trying to use Ctrl-C to exit the program, to no effect, to the point where the developer of a popular clone felt it would be worthwhile to show a hint about how to exit if the user presses Ctrl-CAlthough even doing this doesn't always help.
The story of how these stickers came to be can be found here, and if you feel like getting a few for yourself, they're only a buck each! Even shipping to Australia was an extremely reasonable $2.20, so you really have no excuse, no matter where you are in the world.
I'm doing a lot of work right now for a client where I'm stuck on a back-end server, writing Python in vimLots of print() statements I got a license for PyCharm, but that turned out to be a complete waste of time , and while I'm not one for putting stickers on my laptop, one these these will brighten up my day enormously.
Almost enough to overcome the ignominy of having to use a MacAlmost.
Awasu has had many optimizations made to it over the past few releases, and one of them was a change to how it captures output from plugins. The old code used to set up temp files to capture stdout and stderr, configured the plugin process to send its output to them, then read the captured content when the plugin finished. This was changed in 3.0.4.alpha2 to use in-memory buffers, thus removing the need to use slow disk files.
This worked pretty well, except for one rare, bizarre problem: if Awasu crashed was forcibly terminated via Task Manager while plugins were running, when it was restarted, it was unable to open the server socket it normally listens on for API requests, because another process had it open. The plugins would also hang indefinitely. Awasu was recently changed to automatically find an alternative port, which is kinda cool, but (1) it also kinda sucks if you have scripts that have this port hard-coded, and (2) it's indicative of a serious problem, a zombie kinda problem
When Awasu is started, it checks to see if another copy is already running, and transfers control to that if it is, so the old process was dead enough that the new copy of Awasu wasn't seeing it, but it was alive enough that it was keeping the old socket (and presumably other stuff) open.
I hate zombies.
I finally figured out what the problem was, and thought it might make a good blog post, since it was an interesting situation, and as a PSA to correct an omission in the MSDN example. However, when I went looking for the MSDN example, it did the necessary magic to avoid this problem but since it doesn't explain why it performs these incantations, it's maybe worth jotting down these notes for anyone else running into the same problem...
The old codeError handling has been removed for clarity. created the pipe Awasu captures both stdout and stderr, but stderr is not important for this example, and so is omitted. and launched the plugin process something like this:
The idea is that we create a pipe to capture the output from the plugin process, with 2 handles to access itThere are some things you need to be careful about when using this technique, but they are (sorta) well-known. One (hStdoutWrite) is given to the plugin process so that it can write to the pipeIt's actually connected to the process' stdout, and it doesn't even know anything funky is going on., while the other (hStdoutRead) is used by Awasu to read from it.
But what does it mean to inherit handles, anyway?
When you open something like a file, or socket, or registry key, the Windows kernel creates an in-memory object to manage it, then gives you a handle to it, which is an alias for the underlying kernel object. The thing about these aliases is:
they're only valid within one process (typically the one that opened the underlying object)
there can be more than one of them, even across multiple processes, referring to the same underlying object
When the code above runs, Windows creates the pipe buffer and 2 objects to manage reading/writing it, and gives us handles (i.e. aliases) to those underlying kernel objects:
handle #1 (an alias for kernel object #12These numbers are internal to the kernel, and have no meaning to user programs.)
handle #2 (an alias for kernel object #47)
When the child process is created, it inherits these handlesBecause CreateProcess() was told to do this, and these handles were created as inheritable. i.e. it gets its own copy of them, that refer to the same underlying kernel objects:
The child process needs to inherit these, since it needs the pipe write handle. When it outputs something, it goes to hStdoutWriteBecause we passed it in to CreateProcess() as the process's stdout., and ends up in the pipe buffer. From there, Awasu can read it via its hStdoutRead handle.
You would think that if the reading end of a pipe disappears, anyone trying to write to it would get a "broken pipe" error, but as described above, the plugins would hang indefinitely and the parent awasu.exe got stuck in zombie limbo
If we update our diagram to reflect Awasu disappearing, we can see what's happening:
The child process also inherited a copy of the pipe's read handle (even though it doesn't actually use it), and since the process is still running, Windows thinks the underlying kernel object is still in use and so can't close it. So, since something is still connected to the reading end of the pipe, it's still alive, the plugin merrily writes its output to the pipe buffer, until it fills up, and then waits for someone to read the output, to free up some space so that it can write out more output. Except, of course, the only thing with a read handle to the pipe is the child process itselfWhich it never reads from, since it doesn't need to, that's Awasu's job., so it waits forever, and all this is also apparently enough to stop Windows from fully cleaning up the dead-but-not-quite Awasu process. Sigh...
Once we understand what's going on, the fix is easy: don't inherit the hStdoutRead handle. We set things up like this:
Now, if Awasu disappears, there are no more handles to the pipe's read handle, so Windows will close it, realize the pipe is broken, then returns an error to the plugin the next time it tries to write to it, and in the grand Shakespearian tradition, everyone dies as they should.
I hate sticky headers. I want to kill sticky headers.
So I made this bookmarklet.
It removes those unbelievably annoying full-page overlays, header bars, chat boxes, anything that stays in a fixed position, from a web pageTechnobabble: it looks for anything with a CSS position of "fixed" and removes it from the DOM.. I so want this in Awasu, so I was mulling over how best to implement it, when it occurred to me that you could already do it
Then, when you browse to a page that has these pesky things on it, just run the user tool and they'll be removed from the page!
Those of you who have been here for a while might remember that I used to run a music bar in Thailand a while back. One night, I was doing my one-man show, when a guy in a cowboy hat wandered in and sat down to listen. During the break, I went over and had a chat with him, and found out that, he too, was a musician.
I didn't know it at the time, but he was David LaMotte, and is one of the bigger names in the U.S. folk scene. He was in town to give a show at one of the universities, and was staying at a hotel around the corner.
We got on pretty well, one beer led to another, and we somehow ended up with him performing a special show at the bar, and it was definitely one of the most memorable shows we ever had. I did a lot of recording at the bar, and while this showThere is also video available here, although the video quality is less than stellar was one of the earlier ones I did, and so the sound engineering is less sophisticated than if I did it again today, it's not bad and (hopefully) catches the warmth of his performance. Folk is not something that I'm really into, but his songs are very accessible, and have a warmth and honesty that's quite amazing.
However, the time has come and he's back in the studio, putting down a new CD in what sounds like a fascinating project, with a menagerie of musicians from every continent.
Being the cynical, grumpy old fart I am these days, it's not often I see someone who I would call inspirational, but this guy is definitely one of them. Check out his music, then put a few dineros in his jar to help make the CD happen. I have.
Almost 8 years ago to the day, I wrote about watching Japan play Australia in a World Cup group match, where they held a one goal lead for most of the match, only to concede 3 goals in the last 8 minutes.
Yesterday, Japan played their first group match again the Ivory Coast and while I wasn't able to watch the first half, I caught most of the second, and things seemed to be going well, with Japan having scored early in the game.
I was stuck at a bus station and was literally getting onto the bus when the Ivory Coast scored an equalizer. Nevertheless, I went to sleep on the bus assuring myself that it would end in a 1-1 draw, so I was somewhat miffed to find out this morning that we had, yet again, given away flurry of goals and thrown away the match
Few in the cartooning world have ever spoken to him. Even fewer have ever met him.
In fact, legend has it that when Steven Spielberg called to see if he wanted to make a movie, Bill wouldnâ€™t even take the call.
He then goes on to explain how he sent Bill an email:
[I] thanked him for all his great work and the influence heâ€™d had on me. And never expected to get a reply.
And what do you know, he wrote back.
Let me tell you. Just getting an email from Bill Watterson is one of the most mind-blowing, surreal experiences I have ever had. Bill Watterson really exists? And he sends email? And heâ€™s communicating with me?
But he was. And he had a great sense of humor about the strip I had done, and was very funny, and oh yeah...
...He had a comic strip idea he wanted to run by me.
Turns out, the idea was to guest-draw a few panels in Pearls Before Swine, that ran earlier this month:
The comments people posted for each strip are kinda funny, now that we know what's really going on And check out the full story on Stephan's blog. Meeting your heroes can sometimes be a disappointing experience, but it sounds like this one definitely wasn't.
I've written before about how much I like C&H (seriously, who doesn't?), so the thought that Bill has surfaced and is wielding a pen again is pretty awesome news!
Set my hair on fire, I surely would! Not that there's much left, I'd hardly miss it...
Yup, it's official. Just in case there was any, you know, doubt
If you've been following this blog for a while, you'll know that I like to travel. The first time I hit the road was in '93 and while I didn't really know where I wanted to go, I just had a hankering to go somewhere. I eventually decided on Montreal in Canada - the whole French/English thing sounded intriguing, it's got a great music scene, the food's good, what's not to like? I got a ticket from Oz to Vancouver, with the plan of travelling across Canada by train until I got to Montreal.
It was winter in North America at the time, and my guide book told me that temperatures could drop to -20°C or lower, and me, being fairly young and stupid, thought "oh, that won't be a problem, I'll just pack an extra sweater and she'll be right"
Once in Vancouver, a Canadian guy who had worked in central Canada during the winter explained to me the realities of extremely cold weather, so I decided to head south and travel through America instead. It was a great trip, but I never made it to Montreal and it's been a source of amusement to me that, for all the travel I've done in the intervening 20 years, I still haven't been there.
As part of my quest to visit places before they radically change :), I'm going to Cuba next month. I was supposed to play at a blues festival in Thailand next week, but that got cancelled, and I messed up the flight times for my transit through Toronto, so I ended up having to change my ticket and if I had to do that, I figured I might as well spend a few days in Montreal. Woo hoo!
I checked what the weather was going to be like, and it's spring, so it'll be max'ing out at about 5°C, maybe -10°C at night, and of course, I said to myself "oh, that won't be a problem, I'll just pack an extra sweater and she'll be right"
And after rebooking my flights and hotels, I found out that the east coast of Canada is being mauled by the worst storm in a decade, sinking ships and closing airports. It's far enough east to apparently not be affecting Montreal, but you never know - I'm this close to making it to City of Saints, so I'm sure the gods will be conspiring to make sure I don't actually get there
Anyway, -10°C isn't that bad, and I've got myself a nice warm sweater :), so hopefully it'll all be good. We'll see...
Update: it's gratifying to see that you can still go up against the gods, and win First, Air Canada told me that flights that day from Toronto to Montreal were maybe being cancelled, due to weather in Montreal. Then, they didn't want to honor my ticket, although in all fairness, I used an Australian credit card, in Thailand, to purchase a flight in Canada, so it's understandable they were a bit iffy abut it. However, they made me stand in line for 2 hours to repurchase the same ticket, using the same credit card There were only 3 people in the queue but - and I swear on little green onions, I'm not making this up - they were taking 45-60 minutes to process each person Then the flight almost didn't take off because of mechanical problems.
Note to self: never fly Air Canada again. I've been on flights where there were goats on board that were better organized than these guys
Finally made it, though. I had to laugh when I got to Montreal airport - my backpack came out on the conveyor belt with ice on it, and walking out onto the street, I realized how long it had been since I had seen snow. And -10°C is not that bad; cold has never really bothered me, although I'm very glad I brought my new sweater...
Well, the first problem with talking about Burma is what do you call it? It was renamed as the Union of Myanmar in '89, but some people refuse to use that name since it would confer some legitimacy to the military government. On the other hand, some people are unhappy using the name Burma, since that's what the colonial British called it. You can't win, so I'll call it Burma, since I'm old school 
Anyhow, I was in Burma the other month, and very excited to finally make it. I had planned to go in 2008, but Cyclone Nargis hit, which put a kibosh on that trip. It affected only a small part of the country, but IIRC, the government was so intent on controlling the message that was getting out, and stopping journalists from running around and reporting on stuff, that they made it very difficult to get in.
Nowadays, it's a completely different story. The government has opened things up for tourism, and while there are still parts of the country foreigners are not allowed to go, it's much easier to get in and travel around, and tourist numbers have been nearly doubling annually for the past few years.
Of course, there's a lot of debate about whether or not people should visit the country, since a lot of your tourist dollars end up in the hands of the government, but many feel (as I do), that small-scale tourism can be very beneficial to people on the street, not only financially but also in terms of bringing in outside knowledge and experiences and influences.
Mrauk-U and Sittwe
Mrauk-U is the old capital of the Arakanese kingdom, with many temples scattered around the town. It's definitely not on the main tourist trail and the area was recently closed off to foreigners due to fighting. Everyone was telling me that road travel was forbidden and you had to fly, but I'd heard word of some people that had made it through by bus, so I decided to give it a shot. Like many things in Burma, there are rules upon rules, but no-one really cares about enforcing them, and I managed to make it all the way by bus. It was a brutal 36-hour trip :bigshock:, including several checkpoints where I slid down in my seat and pulled my cap down over my eyes. Being Asian surely helped a bit there
I was surprised at how developed Sittwe was, with paved roads, small supermarkets and internet cafes. If you squinted just right, it could just be another small town in country Thailand. No buffalo wandering the main road here. There is some tension between the various ethnic groups, and Buddhists and Muslims, and unlike most of the other places I visited, it was clearly visible, with parts of the town blocked off as Muslim-only areas, armed guards blocking entry.
But while checking out temples is fine, I always much prefer just walking around and getting out of town. People were lovely all over Burma, and noticeably honest. There weren't the blatant rip-offs and scams that infest Thailand, and I was happy ordering meals without checking the price first, and letting people pick their change out of my wallet.
And the kids were delightful...
I also love visiting markets. They're noisy and crowded and chaotic and Sittwe's Central Market was all of that, and then some. Sittwe is on the western side of Burma, near India and Bangladesh, and there were an amazing number of different ethnic groups there. I haven't seen a market like this since the souks in the Middle East! Check out those fish!
Yangon was, until recently, the capital of Burma, when the government decided to pick everything up and move it all to Naypyidaw, although it's still the largest and busiest city in Burma.
The extraordinary rate at which things are changing is most apparent here. Most people have mobile phones, and smartphones at that; I saw only a handful of Nokia's during the entire trip. The roads are clogged with modern cars (motorbikes are banned  :shock:), and Western-style hotels and cafes and malls are going up all over the place.
I stayed in the downtown area, which is completely overrun with street markets. Cool!
The name Mandalay conjures up so many images but in reality, it's a dusty, polluted, crowded city
However, there was a huge market near where I was staying and I was there in the late afternoon, when the nuns were making their rounds.
Outside the city, on the other hand, is beautiful. U-Bein bridge is the longest teak bridge in the world and while the guidebook painted a picture of monks daintly crossing it at the break of dawn, the reality was that it was mostly joggers and other people doing aerobics and tai-chi, so the bridge was constantly bouncing up and down. Still very pretty, though...
Bagan is one of the tourist hotspots, with hundreds of temples dotted around the countryside. Many of them are still in active use and easily accessible on the small electric bikes that foreigners are allowed to ride. It's just as impressive as Angkor Wat, but there are hardly any people there!
As luck would have it, on my last night I saw a post from Ethan Zuckerman about a talk he had recently given in Yangon. Bugger, if I'd've known, I would've gone down. I've been following his work for quite a few years, and his blog is one of those that I recommend to new users of Awasu after they install it.
It was a great post, but I did find one thing that he wrote a bit odd:
... but I am most interested in the question of how the internet may change what it means to be a citizen. There have been great hopes for the internet and democracy, the idea that governments can listen to peopleâ€™s wants and needs more directly, that citizens might vote directly on legislation or help draft new laws, that we might have robust debates in a digital pubic sphere where itâ€™s possible for everyone to express their opinions.
I would've thought the more interesting question would be how the internet allows individuals to effect change. One can only assume that during the Arab Spring and other similar events, people weren't using the internet to discuss ideas or vote on new legislation It's about people connecting with each other, spreading news and information and new ideas, without middlemen, with their agendas and spin, and this is one of the big reasons why I favor small-scale tourism in places like this. The government is slowly opening access to the internet and allowing foreigners in, but I suspect they'll find that once they let the genie out of the bottle, it will be difficult to keep it on a leash
 Yes, I also can't get my head around Ho Chi Min City and still call it Saigon.  The rumor is that a general's son was killed by a motorbike.
I'm not one for link dumps but these are too good not to share.
One of the downsides of having been doing IT for as long as I have  is that you've heard all the jokes many times before, but here's a list of some new ones.
Using if(constant == variable) instead of if(variable == constant), like if (4 == foo). Because it's like saying "if blue is the sky" or "if tall is the man".
The best one is hidden way down in the comments:
Yoda Exception Handling: Do, or do not; there is no try.
Next up is an amazingly interesting list of useful hidden features in Python. I tend to use Python as a better scripting language (since writing anything longer than a few lines in shell script or Windows batch files Truly Sucks®) but things like this remind me how really cool it is.
I'm hoping to have a bit of free time over the next few weeks (yeah, right :roll:) and one of the things I want to do is to spend a bit of time looking into the new features of Python. If you're into Python, JetBrains recently released a free version of their PyCharm IDE, and after a quick play with it, it looks pretty good. These are the same guys who make the IntelliJ IDE, which I have used , and is probably the only piece of Java software I've used that I have any time for
As an aside, I'm in Cebu in the Philippines right now , which is not far from where the big earthquake happened and I was woken up yesterday morning by the whole room shaking and big cracks appearing in the walls 24 hours later, we're still getting tremors and I've been getting slightly seasick as I work in my room. I'm not sure if it's just my imagination but I'm sure the floor is gently rolling from side to side Tomorrow I sail to Dumaguete, which was also affected, and then in a couple of weeks, I'm off to Taiwan, which is rather close to Fukushima and an incoming typhoon.
Awasu 3.0.1 will be coming soon (hopefully), possibly slightly hot...
 I won't say it, since I'm sure all the kids are sick to death of hearing me say how I started out on punch cards  Yes, I have worked professionally using Java. Just shoot me now My favorite sign is still there, albeit slightly faded.
Awasu and the stylized Japanese character in the orange box are trademarks of Awasu Pty. Ltd. Other brands and product names are trademarks of their respective owners. Awasu Pty. Ltd. believes the information in this publication is accurate as of its publication date. Such information is subject to change without notice. Awasu Pty. Ltd. is not responsible for inadvertent errors.