Blog

Birthday Brewing

Posted on May 10, 2018

Brewing EquipmentOne of my favorite hobbies is brewing beer. After a long hiatus I finally managed to find some time on my birthday to brew my favorite kind of beer, the incredibly strong, lightly hopped, super delicious Belgian Tripel. Don't get me wrong, I love the fact that craft brewing has taken off, but beers now days are just too damn bitter. I mean super bitter. I'm talking about 120 minute IPAs with IBU numbers pushing over 100. But I guess such is the price you pay for living in the United States, where for whatever reason many Americans just like to take things to the extreme. To me the Belgian Tripel is the ideal beer. It's got a high enough ABV at around 10% where there's no chance that the effects of alcohol dehydrogenase will prevent you from getting a buzz, but not so strong that the ethanol aroma must be masked by copious amounts of hops or malt. The Belgian style yeast, which of course is part of what makes it a Belgian frequently imparts some fruity aromas like banana or oranges and often a hint of cloves, a la another great beer Franziskaner.

This post is not about how to make all-grain beer. For that I refer you to the legendary John Palmer's site www.howtobrew.com.

Boil kettleHere's the recipie:

  • 12 lbs. Rahr Premium Pilsner Malt
  • 0.25 lbs. Belgian Aromatic Malt
  • 0.5 lbs. Dingemans Cara 20 Malt
  • 2 lbs. Light Belgian Candi Sugar
  • 0.75 oz. Styrian Goldings (3.3% AA) hops for 60 minutes
  • 0.25 oz. Stryian Goldings (3.3% AA) hops for 5 minutes
  • 15 grams home grown Chinook Hops (12-14% AA) hops for 60 minutes
  • 5 grams home grown Chinook Hops (12-14% AA) hops for 5 minutes
  • 1 lb. orange peel for 5 minutes
  • 1 Whirflock tablet for 5 minutes

The Chinook hops weren't part of the original recipie, but they're what my hop garden produced and I wanted to use them. It's too bad I'm not doing something like a Sierra Nevada IPA or a Dale's Pale Ale since then I think it might make sense to give dry hopping a try, but with a Belgian I think that's a big no-no. The beer is still fermenting so I don't know the final ABV but it measured an O.G. of 1.081 so it should be able to hit 9% easy.

The James Webb Space Telescope

Posted on August 19, 2017

About a year or so ago I learned about the James Webb Space Telescope. The telescope is part of collaboration between NASA, the European Space Agency, and the Canadian Space Agency. It's named after James Webb a soon-to-be-famous NASA administrator that played an important role in the Apollo missions. What sets it apart from the Hubble telescope is its mirror, planned orbit, and instrumentation.

Fucking gold mirrorThe mirror is one of the things that make the telescope so darn awesome. Since launching payloads up into space is very expensive, size and mass are both very constrained, and since the diameter of the rocket payload is fixed, satellites often rely on folding mechanisms such as solar panels that expand. That's where the mirror comes in. Instead of being made of one circular mirror limited to the diameter of the rocket, it's made of 18 hexagonal mirror segments that unfold and combine into one giant mirror. If that wasn't cool enough the engineers over at NASA decided to coat the mirrors in fucking gold. I had assumed the gold was so NASA could use up their remaining annual budget so it wouldn't get cut the next year as punishment for being efficient, but it turns out that the microscopic gold layer improves the mirrors ability to reflect infrared light.

Extra credit if you can derive the proofAnother thing that makes the Webb cool is where it will be orbiting in space. The telescope is going to be at the Earth-Sun L2 Lagrangian point. This is a point further from the sun than earth, where the gravity from the sun and the earth add together allowing an object to orbit the sun faster than in normally would, keeping it orbiting at the same rate as the Earth. This means objects in the L2 point will always be in the shadow of the earth, something particularly useful if you're building a space telescope. The downsides to that point are that it's quite far away (about 4x as far as the moon), which will make the unserviceable if something goes wrong, and it's an unstable point, so the telescope will need to take fuel with it to stabilize and maintain its orbit. Eventually, after 10 years or so the telescope will run out of fuel and will begin to drift away from the L2 point.

Unlike the Hubble which was originally a visible light telescope, the Webb is an infrared telescope. Due to red shift from the ever increasing expansion of space, the light from the earliest days of the universe is no longer in the visible spectrum; instead it has shifted into the infrared portion of the spectrum. Because of this the Webb has been fitted with four different kinds of infrared instruments. The Webb will allow us to see into the past further than we ever have before to gain a better understanding about the origins of the universe. Here's to hoping the mission goes off without a hitch. The telescope is scheduled to launch in October 2018.

Troubleshooting The Linux Firewall By Inserting A Trace Rule

Posted on February 11, 2017

If you are having trouble figuring out whether or not a packet is being dropped by the Linux firewall there is a way to trace the path a packet takes. It does require some knowledge of the ports and protocols involved as well as the ability to make iptables rules. The basic idea is that traffic leaving a Linux box directly, or being routed through it will hit a special table called the "raw" table first where users can put in trace rules. If the traffic is leaving the box directly the rule is added to the "OUTPUT" chain of the "raw" table. If the traffic is being routed through the box then the rule is added to the "PREROUTING" chain of the "raw" table. The general format is

# For traffic being routed through the box
user@linux# iptables -t raw -A PREROUTING [ RULE TO DETECT DESIRED TRAFFIC ] -j TRACE

# For traffic that originates from the box itself
user@linux# iptables -t raw -A OUTPUT [ RULE TO DETECT DESIRED TRAFFIC ] -j TRACE

Please note: Adding trace rules can add a very heavy burden on the kernel and can impact performance and potentially the stability of the system. They are for troubleshooting purposes only. Trace rules should always be deleted immediately after are done! To delete a rule you inserted simply change the -A for append to -D for delete.

Most of the time the kernel will not be built with the trace modules included by default. If they are not already present you can use modprobe to install the logging modules. Here are some examples:

# For older kernels.
user@linux# sudo modprobe ipt_LOG

# For newer kernels.
sudo modprobe nf_log_ipv4

# Trace TCP traffic leaving the Linux box
user@linux# iptables -t raw -A OUTPUT -p tcp --dport 80 -j TRACE

# Trace TCP traffic returning to the Linux box
user@linux# iptables -t raw -A PREROUTING -p tcp -sport 80 -j TRACE

The logs themselves will appear in /var/log/kern.log. Here are some sample logs I collected while connecting to www.google.com with wget:

Feb 11 10:41:13 ubuntuvm kernel: [ 4199.166329] TRACE: raw:OUTPUT:policy:2 IN= OUT=eth0 SRC=192.168.1.2 DST=216.58.193.196 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=37314 DF PROTO=TCP SPT=42240 DPT=80 SEQ=3750653972 ACK=0 WINDOW=29200 RES=0x00 SYN URGP=0 OPT (020405B40402080A000EE1D60000000001030307) UID=0 GID=0 Feb 11 10:41:13 ubuntuvm kernel: [ 4199.182926] TRACE: raw:PREROUTING:policy:2 IN=eth0 OUT= MAC=08:00:27:2e:a1:89:00:90:7f:91:68:b4:08:00 SRC=216.58.193.196 DST=192.168.1.2 LEN=60 TOS=0x00 PREC=0x00 TTL=56 ID=31143 PROTO=TCP SPT=80 DPT=42240 SEQ=1985453739 ACK=3750653973 WINDOW=42540 RES=0x00 ACK SYN URGP=0 OPT (020405780402080A082895B6000EE1D601030307)

While this example clearly isn't very useful it should be enough to get most people going with tracing packets through the Linux firewall. The only thing you must know is how to write the correct trace rules for the traffic you are interested in. There is tons information in the blogosphere about Linux IPTables and how to write firewall rules, or you can just RTFM with "man iptables", and "man iptables-extensions".

Styled Math Inline HTML with LaTeX

Posted on January 23, 2017

The fact that it was so easy to get code styled inline HTML got me wondering what else could be quickly put together using a JavaScript library. What about complex math symbols? Another quick Google search and sure enough someone has already done something like this. In academia it's common for people to write whitepapers that have math symbols in them that are generated by compiling Tex or LaTeX markup. The MathJax library allows one to place Tex/LaTeX symbols inline an HTML document and to automatically generate pretty automatically formatted math symbols into a webpage. You just take the LaTeX and surround it with \[ and \] and it automatically gets converted into beautifully formatted math symbols. The LaTeX text below:

\[ \oint_C {E \cdot d\ell = - \frac{d}{{dt}}} \int_S {B_n dA} \]

becomes Faraday's law:

\[ \oint_C {E \cdot d\ell = - \frac{d}{{dt}}} \int_S {B_n dA} \]


Automatically Styled Code Inline HTML

Posted on January 21, 2017

I've always wondered how so many programming blogs have neatly formatted code examples. After doing a quick google search it turns out there's many existing options out there. The one in particular I used for the example below is called "SyntaxHighligther." The documentation over there is very well written and easy to follow. All that is required is to download 4 files, a couple of core CSS and JavaScript files, an additional CSS file for the theme, and a JavaScript file corresponding the programming language being used. Then simply add links to the JavaScript and CSS files in the head of your page, and apply the style inline (in my case "bush: cpp") to the <pre> tag and you're good to go.

class Rectangle {
    int width, height;
  public:
    void set_values (int,int);
    int area (void);
} rect;

Blog Goes Live

Posted on January 20, 2017

The goal here is to post at least one entry a week. Eventually once there are enough posts about the same subject I will create individual pages for each subject.