Instant Mini Webserver

This post is more documentation for myself – but in case it helps anyone else:

With python, you can instantly spin up a mini-webserver in your current directory. This is excellent for quick testing webpages or HTML files that are causing you browser security problems or have features or dependencies that don’t render well when loaded as a file.

Super easy: python -c “import SimpleHTTPServer;SimpleHTTPServer.test()”

Run that in the directory with your files, and you’re done!

$python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"
Serving HTTP on 0.0.0.0 port 8000 ...
127.0.0.1 - - [16/Oct/2014 12:42:52] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [16/Oct/2014 12:42:52] code 404, message File not found
127.0.0.1 - - [16/Oct/2014 12:42:52] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [16/Oct/2014 12:42:55] "GET /mypage.html HTTP/1.1" 200 -

Dual Booting the BeagleBone Black

What I wanted, I thought, was simple. I had just gotten my first Beagleboard (the BeagleBone Black) and I had a couple of SD cards. I messed around with the installed Angstrom Linux and then decided I wanted to return the whole thing to factory state. I found the “flash your eMMC” image for the Angstrom stock install and went through that process and restored it.

Now I wanted to try Ubuntu. I grabbed a version to run off of the SD card and all was well (as long as I booted while holding down the “boot from SD” button). I decide what I really want, is for it to boot from the SD card when it’s inserted but boot the original stock Angstrom when it’s not inserted. Down the rabbit hole I go.

I discover that this will work, provided I flash Ubuntu to the eMMC – but that’s not what I want. I want the stock Angstrom on the eMMC and Ubuntu on the SD. So after much digging and reading about U-Boot and uEnv.txt and boot loaders I end with this solution:

Solution

  • Boot to Ubuntu, then mount the eMMC FAT partition (partition 1, where the bootloader files are located) to /mnt
  • Create a backup directory in /mnt and save a copy of the MLO and u-boot.img files (in case you want to undo this later)
  • Copy (overwrite) the  MLO and  u-boot.img files with the Ubuntu versions (likely in /boot/uboot at this point)
  • Now the tricky part – the Ubuntu u-boot loader only wants to boot a zImage and the Angstrom image comes with a uImage
  • We have to convert the Angstrom uImage to a zImage (which, luckily, is easy)
  • Unmount the FAT partition and mount the ext partition (partition 2) on the eMMC to /mnt, switch to the /mnt/boot directory
  • Convert the kernel image file: dd if=uImage-3.8.13 of=zImage bs=64 skip=1
  • This basically is just cutting off the first 64 bytes, a uImage is really just a zImage with a u-boot header prepended
  • Now leave this file there (and it _must_ be named zImage as this is what the Ubuntu uboot loader is looking for)
  • Unmount /mnt and you’re done

At this point you should be able to boot to Ubuntu when the SD card is inserted and Angstrom when it’s not, and none of this requires holding that button down :-)

 

Harmony Remote Canon EOS Rebel

Mostly notes for myself here…

You can program your Harmony remote to release the shutter immediately and with a two second delay. It took a lot of searching, but in the end the method I used was to use Pronto codes.

The basic gist of it was to log into the Harmony website, find the “Learn Codes” area for your already added but not learned device (I just used some Home Automation generic device), and then “fake out” the learn process with a 3rd part program.

I have an EOS T4i and a Harmony 520.

The pronto codes are:

for instant shot: 0000 007D 0001 0001 000F 00F2 000F 0CDB
For 2 second delay: 0000 007F 0001 0001 000F 00B0 000F 0CBE

The “fake out” software, as well as the software that translates the Pronto codes,is here.

The whole process is detailed here.

Local Tea Shops and Minimum Limits

One thought I had this Christmas was to get my wife a variety of loose leaf teas. She’s expressed an interest in exploring better teas, but neither of us know much about it. So I thought, why not go get 5-10 small packets of tea (maybe 1 oz or around that amount)?

Unfortunately, none of the local tea shops will sell tea in quantities smaller than 2 oz, which I understand makes about 25 cups or so. That’s a lot of tea to decide if you like something. I find this very frustrating, I tried Adagio, Tea Harbor and Teavana. No luck at any of them. Adagio even sells smaller quantities online, but not if you go into the store. Some of them had some gift basket type packages, but none with more than four teas, and even then – it was larger quantities of those 4.

I find this somewhat baffling – the only reason I can think of that someone would want to buy smaller quantities of several teas is to try a bunch out – when they’re first getting exposed to loose leaf teas. They are your potential new customers. Once they know what they like, they’ll probably be going back for larger quantities of those teas. So why discourage your new customers before they even get started? Packaging cost/cost of the sale? I guess maybe, although at $5 – $20 oz I doubt it. All three stores happily turned down a $60-$80 sale from me due to these minimums.

I wonder why I even bother trying to shop locally anymore.

Customer Service, GAMA (Origins), Facebook and BGG

I’m certain providing good customer service takes a lot of time and effort. At the same time, several aspects of it seem to me, to be self-evident. I’ve recently witnessed what I’d call a customer service FAIL by GAMA and it’s damaging their reputation. For anyone with an online presence I’d venture to say this might be what you want to see in order of preference from most desirable to least desirable.

  1. Lots of praise for your products/brand, no-one has any issues
  2. A few occasional issues which are dealt with privately
  3. Praise for your customer service itself – such as “I had so-and-such and issue but Company-X took good care of me, I feel so loved!!”
  4. Criticism of your customer service – “I can’t get any response from Company-X…”
  5. Criticism of your products

I’m debating whether #2 and #3 should actually be reversed. Everyone knows problems do occur at times, I personally feel more re-assured seeing a couple of issues that were handled well by the vendor than seeing nothing at all. The problem starts when you, as a company, aren’t able to generate that #3 outcome for whatever reason (you don’t have time or resources, you don’t care, you have people interfacing with the public that lack people-skills, …etc). So now, you start to focus on the #2 item – you don’t want problems or issues exposed or discussed in public (because it’s been turning out badly). The catch here is that the more try to keep things out of the public eye, the more skeptical everyone watching becomes (and rightfully so).

Trying to control/limit the discussion surrounding your company or products doesn’t work. Negatively weighting (or deleting) negative Facebook comments will only erode the customer’s confidence in the value of the information there. Shutting down your forums only moves the discussion elsewhere, such as the Gencon forums, or BGG, or other locations all together to which you might not even have visibility.

In reality, there’s only two ways to succeed here. Either provide a product so good/unique that everyone will overlook poor support and you can essentially ignore any complaints, or invest more heavily in excellent customer service and build a loyal customer base. The former is very hard to pull off and as soon as there’s any competition all your spurned customers will leave you and take their friends with them. The latter is clearly the better long term strategy and strong customer loyalty goes a very long ways when issues do occur, however to accomplish this takes dedicated, persistent effort by people experienced in dealing with the public in a customer service/PR capacity.

GAMA isn’t really doing either of these things right now and they’re suffering for it.

How to make Wine virtual desktop fullscreen (Planescape)

I’m trying to play Planescape Torment in Linux, on my second monitor. This is a bit tricky because if I run it without the Wine virtual desktop it will only work on my primary screen. If I enable the virtual desktop, I have the title bar and borders and such. So how can I run it essentially full screen on my second monitor?

  1. Enable virtual desktop in winecfg
  2. Set the desktop size to the resolution of the monitor you want to run it on
  3. Start it up
  4. Drag it to the monitor where you want it
  5. Grab a copy of ‘wmctrl’ from your distribution (in my case Arch 64 AUR)
  6. In a terminal window do ‘wmctrl -r “Default – Wine desktop” -b add,fullscreen’
  7. Boom! You’re fullscreen on your desired monitor

This utility can modify running windows and do all sorts of things to them. Very nifty indeed. You can see a list of windows you can interact with using “wmctrl -l”.

Improving the Usability of My Terminal

I don’t know why I haven’t spent much time on this before, but I just finished revamping the interface of the program I use more often than any other (at least these days) – a shell via gnome-terminal. This was a few hours of discovery very well spent.

I’m sure there are lots of valid arguments for other terminals as well, but I like gnome-terminal, it’s simple, straight forward, always present in a gnome-system, …etc. So lets get to it.

First up, a switch from screen to tmux (AKA – if you’re not already, start using a terminal multiplexer)

If you haven’t used a terminal multiplexer before, you’re missing out. I’ve often said that GNU screen is my all time favorite *nix utility and that’s saying a lot considering all that Unix has to offer. I’ve used screen since the 90s’ with fairly little complaint. It was recently pointed out to me however, that I might want to try tmux instead – being newer, more feature rich, more easily supportable/extendable, and already having wide acceptance across all major OSs. I’m always game to learn something new, so I gave it a spin. While the differences aren’t dramatic, it’s clear to me that it’s “better” and “cleaner”. I, myself, hadn’t made much use of some of the more advanced features of screen that tmux has dramatically improved upon (such as window splitting), but none-the-less, even the basic features turned out to be a little more to my liking. There are improvements in the area of presentation (such as the capabilities of the status bar on the bottom), control (the command structure, buffers, back-scrolling, screen renaming, …etc), and configuration. It’s a little different, but not at all hard to get used to coming from screen.

Ok – so now I’m using it. How do I get it set up the way I like it? Well, here’s my ~/.tmux.conf file. You’ll have your own preferences, but this could serve as a starting point.

Next – how to get it working like my favorite screen setup. That is to say, I like it to launch when I connect and reattach to my previous existing session, right where I left off. In screen this is accomplished by launching it from your .bash_profile with the ‘-D -R’ options. In tmux there are a couple of ways to accomplish this same thing:

Method 1

  • Add the following to your .bashrc file right underneath “[[ $- != *i* ]] && return”
    [[ $TERM != "screen" ]] && exec tmux -2 att -d
  • Ensure that your ~/.tmux.conf file contains the line “new session” somewhere in it.

Method 2

  • Add the following to the end of your .bash_profile
    tmux attach -d || tmux new

Next up, better colors

I’ve recently come to be a big fan of the Solarized precision color scheme. So lets put that in place. We’re already using it in tmux if you grabbed my .tmux.conf file and are launching tmux with the ‘-2’ option (assume 256 color terminal). How about for gnome-terminal itself?

You can see details on this here, but basically the steps are simple.

  • git clone git://github.com/sigurdga/gnome-terminal-colors-solarized.git
  • cd gnome-terminal-colors-solarized
  • ./install.sh

It walks you through the rest of the process, it’s dead simple.

Want those snazzy colors for your directory listings? More info here, but essentially here are the steps.

  • wget –no-check-certificate https://raw.github.com/seebi/dircolors-solarized/master/dircolors.ansi-light
  • wget –no-check-certificate https://raw.github.com/seebi/dircolors-solarized/master/dircolors.ansi-dark
  • Choose one of these (light or dark according to your preference) and put it in your home directory, perhaps named something like ~/.dir_colors
  • Add “eval $(dircolors ~/.dir_colors)” to the end of your ~/.bashrc file
  • Also make sure ls is aliased if it’s not already in your .bashrc (alias ls='ls --color=auto')

Here we are:

Looking better!

Ok, lastly fonts

A great font can make things look *much* nicer. I need to explore mono-spaced fonts more often to keep up with the new developments. Here are a few I tried (including some I didn’t like).

Fonts

Courier New

Proggy Clean

Consolas

Bitstream Vera Sans

ti92pluspc

Crystal
At present I’m torn between ti92pluspc and Bitsream Vera Sans, they’re both great. There are some nice looking fonts out there to be sure! For more, check out this programmer’s resource.

Git Notes

These are my personal notes on using Git. When working in Java, I develop with Intellij Idea. I have a revision control server that I use to track revisions and backup code. It’s a running document. I’ve published it in case it might answer someone else’s questions from time to time.

Starting a new project

On server housing the repository:

  • create new project directory
  • enter that directory and run “git init –bare”

On client:

  • cd my_project
  • git init
  • git add .
  • git commit -m “My initial commit message”
  • git remote add origin git@example.com:my_project
  • git push -u origin master

Using git

Committing changes:

This is really a two step process. Git uses a “staging area” to hold what you want to commit. It does this so that you can commit only a subset of the files (or even a subset of the data) that you’ve changed to a single commit. That way you organize your changes into discrete commits.

So basically you do a “git add” on the files you want to commit, then you do a “git commit” to commit them.

Intellij Idea does this in one sweep when you choose “commit” in the IDE. You can do it all at once from the command line with “git commit -a”.

General working model:

Start a new branch when you start working on something new. Once complete, switch to the master branch and “merge” it in. If you want your branch to be saved on the remote (I typically do), then be sure you push that branch to a remote branch of the same name, otherwise changes to that branch won’t go to the remote when you “push”. This can be done right in Intellij with an option in the commit window.

The ‘git clone’ command automatically sets up a ‘master’ branch that is a tracking branch for ‘origin/master’ – the master branch on the cloned repository.

FAQs

Q. How can I see the detail of a tag (a full tag, not a “short” tag?

A. git tag -v [TAGNAME] such as “git tag -v v1.0”

Q. How can I send my tags to the remote?

A. git push –tags

Q. What can’t I see my tags in the log/graph in Intellij?

A1. Tags don’t show up properly until you reload your project (at least in 11.1.1 Build #IC-117.117)

A2. If the entry already has several “boxes” on it (such as [master][origin/master], …etc) the tab might not have room to show up. You’ll see it if you click on the entry.

Q. How do I undo the uncommitted changes I’ve made in my current branch?

A. git reset –hard HEAD

Q. How can I recommit/modify what I just committed? I.E. – I meant to do one more thing before I committed but forgot?

A. Use the –amend flag on the commit, it will replace the head commit with a new one.

Q. How can I delete a tag?

A. “git tag -d [TAGNAME]” will delete it locally. Then “git push origin :refs/tags/[TAGNAME]” will delete if off the remote.

Q. How can I get rid of my last commit?

A. “git reset –hard HEAD~1”, then if you want to push that to the server “git push origin HEAD –force”

Q. How can I rename a branch?

A. git branch -m old_branch new_branch

Q. How do I push a new branch to the remote?

A. git push origin branchname

Q. How can I delete a branch?

A. To delete it on the remote – ‘git push origin :branchname’ and then locally – ‘git branch -d branchname’

Q. How do I “check out” a project to a new directory?

A. You clone the repository with ‘git clone git@example.com:my_project’

Vaping for Ulcerative Colitis Part 2 (trial overview)

Please note that I am not a doctor and nothing on this website constitutes medical advice.  Please do your own research.

Trial period and criteria

I decided on a 6 week trial set to begin… when I received my order. So the start date was Dec 23rd. Before I started, I decided to identify some things to track before and after the trial. Here is what I came up with:

  1. Stomach pain (especially in the morning)
    • This had been an ongoing symptom for several years (I’m not positive it’s UC related, but it I believe it is).
    • I’ve had numerous tests  (CT scans, ultrasounds, pill cams, x-rays, …etc) but have been unable to determine the cause of this pain
  2. Frequency of bathroom visits (2 to 3 prior to the trial)
  3. “Quality” of bowel movement (won’t get into too much detail here, but it’s not good)
  4. Beau’s lines on my toes (this can be a symptom of UC and I’ve had them ever since diagnosis)
  5. Energy level (on a scale of 1 to 10, I’ll give it a pre-trial value of 4)

What I’m actually trying

I purchased an eGo mega started kit along with a variety of e-juices (in order to determine what I like). I purchased a few different nicotine levels including 15, 18, and 24mg (mg per ml). I set out initially with the 18mg and starting vaping in a fashion similar to when I smoked. This amounts in vaping terms to about 2ml a day, roughly equivalent to about a pack a day.

Initial thoughts and concerns

My primary concern was that vaping wouldn’t help and I’d end up with a new debatably bad habit. Before starting out I did an extensive amount of research on vaping (on the internet). While there have not been any long term studies, it does appear to be less harmful than smoking – so at least there’s that. Many places state that nicotine itself, without all the other things a real cigarette (or “analog” as vapers call them) contains, is no more harmful or addictive than caffeine. To be fair, however, a lot of places claim that caffeine is quite harmful and addictive.

The first thing I noticed was how quickly I took to vaping despite not having touched a cigarette in over 8 years. Within days I was vaping full steam (pun intended). In fact, compared to smoking, it’s significantly more convenient:

  • You can have a single drag and put it away
  • No detectable smell
  • You can vape in the car with the windows up (since it’s cold old now)
  • You can vape indoors without bothering anyone
  • I even vape occasionally at my desk at work and a quick drag here and there goes completely unnoticed

At any rate, these factors add up to the ability to potentially vape a lot more than I actually used to smoke – which is a little scary.

For setting the baseline on my Beau’s lines, I’ve included a picture of my big toes (I don’t have them on my other toes). Don’t click on it if you don’t want a HUGE picture of toes on your screen :-)

An update at about the three week period in Part 3.

Vaping for Ulcerative Colitis Part 1

Please note that I am not a doctor and nothing on this website constitutes medical advice.  Please do your own research.

Vaping?

I’ve decided to try using an e-cigarette (e.g. “vaping”) as a supplemental therapy for my condition (ulcerative colitis). I’m going to document this experience here so that I can keep track of of the effects over time. If this proves useful for anyone else, all the better.

Ulcerative colitis is generally recognized as a disease of non-smokers. This means that there is a highly disproportionate number of smokers who have ulcerative colitis as compared to non-smokers (smokers don’t have UC). The exact mechanism of smoking’s effect on UC is unknown, however studies have been done which suggest that the nicotine in cigarettes is a primary factor (these are easy to find, just Google for “ulcerative colitis nicotine”).

First a brief history

Discussing ulcerative colitis isn’t pleasant (although it isn’t that bad) – none the less, be forwarned.

I’m a 38 years old ex-smoker (quit 8 years ago) and I was diagnosed with “moderate” ulcerative colitis in late 2007 (via colonoscopy). The active area is primarily left side/sigmoid. There’s been various changes to my treatment regimen over time, but all within the 5asa family (no steroids). At present I’m on three forms of 5asa: 2.4mg Lialda/day, 1 Canasa/day, and 1 Rowasa every other day. Things are mostly in control with this treatment.

Over the past year an idea has been forming in my mind that I might not be as healthy as I could be or should be, hence this experiment.

Details of my six week trial in Part 2.