# Blog

## 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.

The 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.

Another 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

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}$

$\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.