Friday, December 30, 2016

Making a Dobsonian from an Ikea Bedside Table

The Ikea RAST bedside table is cheap, made of pine, and happens to be almost a perfect fit for a typical 8" Newtonian OTA.
The upper and lower shelves just about fit an 8" OTA, and if you remove the left vertical plank in the photo above, and screw it to the back of the two shelves, you have the beginnings of a Dobsonian base.

I used an 8" f/4 Newtonian (an AT8IN actually) with its tube rings, and bolted two halves of a 12" diameter chopping board to the tube rings to serve as altitude bearings.  I had to use a number of fender washers to get the spacing right, but the diameter of the AT8IN is almost perfect for the Ikea table (about three washers were required to get the right spacing).



A significant advantage of this scheme is that by removing the trunnion bearings (which are held on with two M6 hex-head bolts on each side) and attaching a dovetail, the scope can be used for imaging.

Also, the scope has an extended-length aluminum tube of 2mm thickness, which is incredibly rigid (the original AstroTech tube was 0.8mm thick steel) while weighing the same as the original tube. In addition, because the tube is extended, focus can be achieved with a Paracorr without racking out the focuser, which improves the rigidity of the imaging train significantly.



Here's another view of the 12" diameter chopping board. I used the same type of chopping board as the azimuth base (and printed setting circles as well). It was necessary to cut V-shaped channels in the side of the Ikea bedside table to support the trunnion bearings.

The bearing surface is a rough glass fiber (FRP) strip that I purchased from AstroGoods.com and the bearings are virgin teflon blocks. The azimuth bearing surface is also an FRP strip from AstroGoods (I did not go for the vinyl LP record trick here).

I have used this setup to track Mars at 320X during the last opposition and while it's a tricky affair, it's actually usable. While the AstroTech 8" f/4 has a huge secondary, for Mars it was quite acceptable due to the small exit pupil.






I replaced the secondary collimation bolts with stainless steel M4 hardware:



There is a CatsEye hotspot on the primary mirror:



And all steel fasteners have been replaced with hex-head stainless steel hardware. Also note the seam in the faux carbon fiber covering: the aluminum tube underneath is unpainted, and I wrapped the tube in vinyl carbon fiber lookalike (used for wrapping cars).


The primary collimation locking bolts have been relocated next to the collimation knobs, and the primary support springs have been replaced with much stronger ones. This allows the Newtonian to hold collimation very well when used for imaging:


In addition, the telescope has a 2" Feathertouch focuser which is incredibly smooth and a joy to use.



I don't like to think about how much I've spent on this project in total. It is certainly several multiples of the price of a stock 8" dobsonian. However, this scope is better than a stock 8" dobsonian or a stock 8" imaging Newtonian in all possible ways.






Parsing VPC Flow Logs with Pandas

Here's a trivial code snippet to parse AWS VPC Flow Logs. This is extremely useful when setting up permissive security groups and then tightening them up later.

This script will (probably) fail if there are too many VPC flow log files (and therefore the Python interpreter would run out of memory). However it's nice to see that Pandas read_csv can read S3 URL's directly (even gzip'ped CSV files).

You can also filter for REJECT  rule and find out all the IP's that have been attempting to attack you.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from boto.s3.connection import S3Connection
import pandas as pd
import os

srcbucket = 'flowlogs-bucket-orly'
aws_access_key = 'AKIAxxx'
aws_secret_key = 'oRCIxxx'

os.environ['AWS_ACCESS_KEY_ID'] = aws_access_key
os.environ['AWS_SECRET_ACCESS_KEY'] = aws_secret_key

cols = [ 'timestamp', 'version', 'accountid', 'interfaceid', 'srcaddr', 'dstaddr', 'srcport', 'dstport', 'protocol', 'packets', 'bytes', 'start', 'end', 'action', 'logstatus']

# iterate over all the VPC flowlogs in the bucket
conn = S3Connection(aws_access_key, aws_secret_key)
bucket = conn.get_bucket(srcbucket)

count = 0
for key in bucket.list():
    keystr = key.name.encode('utf-8')
    if 'eni-' in keystr:
        s3url = 's3://' + srcbucket + '/' + keystr
        count = count + 1
        
        if (count == 1):
            df = pd.read_csv(s3url, delim_whitespace=True, header=None, names=cols, low_memory=True)
            df = df [ df['action'] == 'ACCEPT']
        else:
            df2 = pd.read_csv(s3url, delim_whitespace=True, header=None, names=cols, low_memory=True)
            df2 = df2 [ df2['action'] == 'ACCEPT']
            df = df.append(df2, ignore_index=True)
        
        print 'Processed ' + keystr

src = df.groupby(['srcaddr', 'dstaddr', 'dstport']).size().reset_index()
src.columns = [ 'srcaddr', 'dstaddr', 'dstport', 'count' ]

n = src.sort_values(by = ['count', 'srcaddr', 'dstaddr'], ascending=False)

print(n)

Tuesday, June 28, 2016

Printing Your Own Azimuth Setting Circles

If you ever are in need of printing your own azimuth setting circles, having a piece of software to generate the rule marks is very useful.

I needed to create a 360-degree paper tape to wrap around the base of my dobsonian, which had a roughly 12" diameter (I measured its circumference at 955mm).  Here's a Perl script which generates a PostScript file on STDOUT. You will need to change the circumference on line 9 (in millimeters). Then you would need a utility such as ps2pdf to convert the PostScript file to PDF and print it out (taking note when printing out to avoid scaling the file).

The script attempts to create the paper tape on a single sheet of paper, and currently will not behave properly for circumferences that exceed the size of the single sheet of paper.  I really should fix the script so that it creates more than four segments for the tape.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/perl
#
# generate a 360-degree scale tape using postscript

use strict;
use POSIX;

# define the circumference of the circle
my $circ = 955;
my $mm_per_degree = $circ / 360;

# derivations
my $point_per_mm = 72 / 25.4;
my $point_per_degree = $point_per_mm / $mm_per_degree;

# minimum (x, y) in points (for margin)
my $minX = 36;
my $minY = 36;


# go from 0.. 360 degrees
for (my $deg = 0; $deg < 360; $deg++) {
 my $x_offset = POSIX::floor($deg / 90) * 64 + $minX;
 my $y_offset = $minY;

 my $mm = ($deg % 90) * $mm_per_degree;
 my $y = ($mm * $point_per_mm) + $y_offset;

 my $line_length = 18;
 if ($deg % 5 == 0) { $line_length = 24; }
 if ($deg % 10 == 0) { $line_length = 32; }

 my $lX = $x_offset + $line_length;
 my $tX = $x_offset + $line_length + 10;

 # estimate the length of the text label
 my $labelLen = length(sprintf("%d", $deg));
 my $tY = $y - (3 * $labelLen);

 print <<EOF;
newpath
$x_offset $y moveto
$lX $y lineto
1 setlinewidth
stroke
EOF

 # add an additional (long) line at the end and a long rule for cutting
 if ($deg % 90 == 89) {
  my $nY = (($deg % 90) + 1) * $mm_per_degree * $point_per_mm + $y_offset;
  my $lX = $x_offset + 48;

  my $cX = $x_offset + 48;

  print <<EOF;
$x_offset $nY moveto
$lX $nY lineto
1 setlinewidth
stroke

$x_offset $minY moveto
$x_offset $nY lineto
1 setlinewidth
stroke

$cX $minY moveto
$cX $nY lineto
1 setlinewidth
stroke
EOF
 }

 if ($deg % 10 == 0) {
  print <<EOF;
$tX $tY moveto
90 rotate
/Courier findfont 12 scalefont setfont
($deg) show
-90 rotate
EOF
 }
}
print "showpage";

And here's what the PDF output looks like:


Cut carefully!

Sunday, April 10, 2016

Connecting to Amazon Redshift (or generic PostgreSQL) with Oracle SQL Developer

I guess old habits die hard; I've never used TOAD in my life but having a GUI-based SQL client is often convenient. I've used Oracle SQL Developer on and off for years (after all, it is free as in beer) and it works well enough for me.

I've recently had the issue of connecting to Amazon Redshift using SQL Developer, and after some poking around managed to do it, so I'm documenting it here.

1. Get yourself SQL Developer from Oracle's web site

2. Download the PostgreSQL JDBC drivers (the latest ones work fine)

3. Install the PostgreSQL JDBC drivers into SQL Developer as per Oracle's documentation (also see Gokhan's blog post)

The wrinkle is that SQL Developer wants the PostgreSQL database name to match the username, which is not the case for Redshift - Redshift has a separate username/password and database name.

Basically, you need to modify the Hostname field in SQL Developer. Instead of putting in just the hostname of your Redshift cluster, you need to put in hostname:port/databasename?



Note that there is a Port field but this gets ignored if you suffix databasename? to the hostname.

Everything should work as expected after that.

Enjoy columnar database goodness!