diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/bin/VNC-Viewer-6.20.529-Linux-x64 b/bin/VNC-Viewer-6.20.529-Linux-x64 new file mode 100755 index 0000000..ad638e3 Binary files /dev/null and b/bin/VNC-Viewer-6.20.529-Linux-x64 differ diff --git a/bin/all-update.sh b/bin/all-update.sh new file mode 100755 index 0000000..05e64e3 --- /dev/null +++ b/bin/all-update.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +cd $HOME + +function do_git { + echo $1 "(Git)" + cd $1 + git ls-remote --get-url + git pull + cd .. + echo +} + +function do_merc { + echo $1 "(Mercurial)" + cd $1 + hg pull -uv + cd .. + echo +} + +function do_svn { + echo $1 "(Subversion)" + cd $1 + svn info --show-item url + svn update + cd .. + echo +} + +function do_dir { + pwd + echo $1 + echo "-----------------" + for i in * + do + if [ -d $i ]; then + if [ -d $i/.git ]; then + do_git $i + elif [ -d $i/.hg ]; then + do_merc $i + elif [ -d $i/.svn ]; then + do_svn $i + else + cd $i + do_dir $i + cd .. + fi + fi + done +} + +for i in ProbeStar NTCNA CAMP Gits External +do + if [ -L "$i" ]; then + echo "$i: Symlinked" + echo "=============" + elif [ -d "$i" ]; then + if [ "$i" == "ProbeStar" ]; then + $HOME/bin/pstar-update.sh + else + d=`echo "${i,,}"` + if [ -f $HOME/bin/$d-update.sh ]; then + $HOME/bin/$d-update.sh + elif [ -d $i ]; then + cd $i + do_dir $i + cd .. + fi + fi + fi +done + diff --git a/bin/bin2hex b/bin/bin2hex new file mode 100755 index 0000000..e31f244 --- /dev/null +++ b/bin/bin2hex @@ -0,0 +1,3 @@ +#!/bin/sh +hexdump -C "$1" | cut -b9- | cut -d"|" -f1 | tr -d ' \t\n\r' + diff --git a/bin/camp-update.sh b/bin/camp-update.sh new file mode 100755 index 0000000..c5b64b6 --- /dev/null +++ b/bin/camp-update.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +if [ ! -d $HOME/CAMP ]; then + exit 1 +fi + +function do_git { + echo $1 "(Git)" + cd $1 + git ls-remote --get-url + git pull + cd .. + echo +} + +function do_merc { + echo $1 "(Mercurial)" + cd $1 + hg pull -uv + cd .. + echo +} + +function do_svn { + echo $1 "(Subversion)" + cd $1 + svn info --show-item url + svn update + cd .. + echo +} + +function do_dir { + pwd + echo $1 + echo "-----------------" + for i in * + do + if [ -d $i ]; then + if [ -d $i/.git ]; then + do_git $i + elif [ -d $i/.hg ]; then + do_merc $i + elif [ -d $i/.svn ]; then + do_svn $i + else + cd $i + do_dir $i + cd .. + fi + fi + done +} + +if [ -d $HOME/CAMP/Repositories ]; then + cd $HOME/CAMP/Repositories + echo "CAMP Repositories:" + echo "==================" + do_dir . + echo "==================" +fi + diff --git a/bin/cmake-build.sh b/bin/cmake-build.sh new file mode 100755 index 0000000..3e4b9f9 --- /dev/null +++ b/bin/cmake-build.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +mkdir -p build lib +cd build +cmake .. +make diff --git a/bin/cmake-clean.sh b/bin/cmake-clean.sh new file mode 100755 index 0000000..ddc0e15 --- /dev/null +++ b/bin/cmake-clean.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +rm -rf `find . -name CMakeCache.txt` +rm -rf `find . -name CMakeFiles` +rm -rf `find . -name cmake_install.cmake` +rm -rf `find . -name Makefile` +rm -f install_manifest.txt diff --git a/bin/git-init.sh b/bin/git-init.sh new file mode 100755 index 0000000..fdb72c3 --- /dev/null +++ b/bin/git-init.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +cd $HOME/ProbeStar +mkdir $1 +cd $1 +git init +git remote add origin https://www.probestar.com/PStar/$1.git +touch README +git add . +git commit -a -m "Initionalization" +git pull origin master +git push origin master +git branch --set-upstream-to=origin/master master +cd .. diff --git a/bin/gits-checkup.sh b/bin/gits-checkup.sh new file mode 100755 index 0000000..206f708 --- /dev/null +++ b/bin/gits-checkup.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +function do_git { + echo $1 + cd $1 + git ls-remote --get-url | tee -a $HOME/Gits/gits.lst + git status + cd .. + echo +} + +function do_merc { + echo $1 + cd $1 + ht heads + cd .. + echo +} + +function do_svn { + echo $1 + cd $1 + svn status + cd .. + echo +} + +function do_dir { + echo $1 + echo "-----------------" + for i in * + do + if [ -d $i ]; then + if [ -d $i/.git ]; then + do_git $i + elif [ -d $i/.hg ]; then + do_merc $i + elif [ -d $i/.svn ]; then + do_svn $i + else + cd $i + do_dir $i + cd .. + fi + fi + done +} + +if [ -d $HOME/Gits ]; then + cd $HOME/Gits + echo "Git Repositories:" + echo "=================" + cat /dev/null > gits.lst + do_dir . + echo "=================" + echo -n "Total: " + wc -l gits.lst + echo "=================" + if [ `hostname` != "babylon5" ]; then + scp -P 2829 babylon5.probestar.com:~/Gits/gits-master.lst . + sort gits.lst > stig.lst + mv stig.lst gits.lst + sort gits-master.lst > stug.lst + mv stug.lst gits-master.lst + diff -bw gits-master.lst gits.lst + fi + echo "=================" +fi diff --git a/bin/gits-cleanup.sh b/bin/gits-cleanup.sh new file mode 100755 index 0000000..5478e83 --- /dev/null +++ b/bin/gits-cleanup.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +function do_git { + echo $1 + cd $1 + git ls-remote --get-url | tee -a $HOME/Gits/gits.lst + git status + git checkout -- . + git pull + cd .. + echo +} + +function do_merc { + echo $1 + cd $1 + ht heads + cd .. + echo +} + +function do_svn { + echo $1 + cd $1 + svn status + cd .. + echo +} + +function do_dir { + echo $1 + echo "-----------------" + for i in * + do + if [ -d $i ]; then + if [ -d $i/.git ]; then + do_git $i + elif [ -d $i/.hg ]; then + do_merc $i + elif [ -d $i/.svn ]; then + do_svn $i + else + cd $i + do_dir $i + cd .. + fi + fi + done +} + +if [ -d $HOME/Gits ]; then + cd $HOME/Gits + echo "Git Repositories:" + echo "=================" + cat /dev/null > gits.lst + do_dir . + echo "=================" + echo -n "Total: " + wc -l gits.lst + echo "=================" + if [ `hostname` != "babylon5" ]; then + scp -P 2829 babylon5.probestar.com:~/Gits/gits-master.lst . + sort gits.lst > stig.lst + mv stig.lst gits.lst + sort gits-master.lst > stug.lst + mv stug.lst gits-master.lst + diff -bw gits-master.lst gits.lst + fi + echo "=================" +fi diff --git a/bin/gits-update.sh b/bin/gits-update.sh new file mode 100755 index 0000000..d5fdea0 --- /dev/null +++ b/bin/gits-update.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +function do_git { + echo $1 + cd $1 + git ls-remote --get-url | tee -a $HOME/Gits/gits.lst + git pull + cd .. + echo +} + +function do_dir { + echo $1 + echo "-----------------" + for i in * + do + if [ -d $i ]; then + if [ -d $i/.git ]; then + do_git $i + else + cd $i + do_dir $i + cd .. + fi + fi + done +} + +if [ -d $HOME/Gits ]; then + cd $HOME/Gits + echo "Git Repositories:" + echo "=================" + cat /dev/null > gits.lst + do_dir . + echo "=================" + echo -n "Total: " + wc -l gits.lst + echo "=================" + if [ `hostname` == "babylon5" ]; then + sort gits.lst > gits-master.lst + else + scp -P 2829 babylon5.probestar.com:~/Gits/gits-master.lst . + sort gits.lst > stig.lst + mv stig.lst gits.lst + sort gits-master.lst > stug.lst + mv stug.lst gits-master.lst + diff -bw gits-master.lst gits.lst + fi + echo "=================" +fi + diff --git a/bin/hex2bin b/bin/hex2bin new file mode 100755 index 0000000..cd6b2a9 --- /dev/null +++ b/bin/hex2bin @@ -0,0 +1,3 @@ +#!/bin/sh +sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' "$1" | xargs printf + diff --git a/bin/jpg2pdf b/bin/jpg2pdf new file mode 100755 index 0000000..7e28ac0 --- /dev/null +++ b/bin/jpg2pdf @@ -0,0 +1,7 @@ +#!/bin/sh + +#echo $@ +convert -page A4+0+0 $@ out.ps +ps2pdf out.ps out.pdf +rm out.ps +echo "$@ -> out.pdf" diff --git a/bin/ntcna-update.sh b/bin/ntcna-update.sh new file mode 100755 index 0000000..56d8b36 --- /dev/null +++ b/bin/ntcna-update.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +function do_git { + echo $1 "(Git)" + cd $1 + git ls-remote --get-url + git pull + cd .. + echo +} + +function do_merc { + echo $1 "(Mercurial)" + cd $1 + hg pull -uv + cd .. + echo +} + +function do_svn { + echo $1 "(Subversion)" + cd $1 + svn info --show-item url + svn update + cd .. + echo +} + +function do_dir { + pwd + echo $1 + echo "-----------------" + for i in * + do + if [ -d $i ]; then + if [ -d $i/.git ]; then + do_git $i + elif [ -d $i/.hg ]; then + do_merc $i + elif [ -d $i/.svn ]; then + do_svn $i + else + cd $i + do_dir $i + cd .. + fi + fi + done +} + +if [ -d $HOME/NTCNA ]; then + cd $HOME/NTCNA + echo "NTCNA Repositories" + echo "==================" + do_dir . + echo "==================" +fi + diff --git a/bin/pstar-update.sh b/bin/pstar-update.sh new file mode 100755 index 0000000..03e9029 --- /dev/null +++ b/bin/pstar-update.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +function do_git { + echo $1 "(Git)" + cd $1 + git ls-remote --get-url + git pull + cd .. + echo +} + +function do_merc { + echo $1 "(Mercurial)" + cd $1 + hg pull -u + cd .. + echo +} + +function do_svn { + echo $1 "(Subversion)" + cd $1 + svn info --show-item url + svn update + cd .. + echo +} + +function do_dir { + pwd + echo $1 + echo "-----------------" + for i in * + do + if [ -d $i ]; then + if [ -d $i/.git ]; then + do_git $i + elif [ -d $i/.hg ]; then + do_merc $i + elif [ -d $i/.svn ]; then + do_svn $i + else + cd $i + do_dir $i + cd .. + fi + fi + done +} + +if [ -d $HOME/ProbeStar ]; then + cd $HOME/ProbeStar + echo "P* Repositories:" + echo "================" + do_dir . + echo "================" +fi diff --git a/bin/ros-run.sh b/bin/ros-run.sh new file mode 100755 index 0000000..0880709 --- /dev/null +++ b/bin/ros-run.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# ROS Startup +roscore & +rqt & +#rosrun rqt_console rqt_console & +#rosrun rqt_graph rqt_graph & +#rosrun rqt_logger_level rqt_logger_level & + +# ROS Apps diff --git a/bin/self-sanitize.sh b/bin/self-sanitize.sh new file mode 100755 index 0000000..e8c0879 --- /dev/null +++ b/bin/self-sanitize.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +cd $HOME + +# kill running stuff +killall chrome +killall firefox +killall firefox-esr +killall icedove +killall iceweasel +killall ssh + +# stop the jobs +crontab -r + +# delete the hidden +rm -rf .dropbox* .gitconfig .gnupg .icedove .mozilla .pki .ssh .subversion +rm -rf `find . -name google-chrome` +echo "Privatized!" + +# delete the obvious (slow) +for i in Archive Dropbox Gits ProbeStar NTCNA/ProberN +do + rm -rf $i + echo "Scrubbed: $i" +done + +# done +echo "Sanitized!" +sudo shutdown now + diff --git a/bin/srv-update.sh b/bin/srv-update.sh new file mode 100755 index 0000000..1096449 --- /dev/null +++ b/bin/srv-update.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +cd $HOME + +for i in ProbeStar NTCNA CAMP Gits +do + if [ -d "$i" ]; then + if [ "$i" == "ProbeStar" ]; then + $HOME/bin/pstar-update.sh + else + d=`echo "${i,,}"` + $HOME/bin/$d-update.sh + fi + fi +done + diff --git a/bin/svn-status.sh b/bin/svn-status.sh new file mode 100755 index 0000000..4af3030 --- /dev/null +++ b/bin/svn-status.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +svn status | grep '^[A|D|M]' diff --git a/bin/unison b/bin/unison new file mode 100755 index 0000000..ffe3b19 Binary files /dev/null and b/bin/unison differ diff --git a/bin/vnc-viewer b/bin/vnc-viewer new file mode 120000 index 0000000..1065b17 --- /dev/null +++ b/bin/vnc-viewer @@ -0,0 +1 @@ +VNC-Viewer-6.20.529-Linux-x64 \ No newline at end of file diff --git a/bin/xgps b/bin/xgps new file mode 100755 index 0000000..b5ff2fc --- /dev/null +++ b/bin/xgps @@ -0,0 +1,978 @@ +#! /usr/bin/python +# -*- coding: UTF-8 +''' +xgps -- test client for gpsd + +usage: xgps [-D level] [-hV?] [-l degmfmt] [-u units] [-r rotation] + [server[:port[:device]]] +''' + +# This file is Copyright (c) 2010 by the GPSD project +# BSD terms apply: see the file COPYING in the distribution root for details. +# +# This code runs compatibly under Python 2 and 3.x for x >= 2. +# Preserve this property! +from __future__ import absolute_import, print_function, division + +import math +import socket +import sys +import time + +import gps +import gps.clienthelpers + +import cairo + +# Gtk3 imports. Gtk3 requires the require_version(), which then causes +# pylint to complain about the subsequent "non-top" imports. +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import GObject # pylint: disable=wrong-import-position +from gi.repository import Gtk # pylint: disable=wrong-import-position +from gi.repository import Gdk # pylint: disable=wrong-import-position + +gui_about = '''\ +This is xgps, a test client for the gpsd daemon. + +By Eric S. Raymond for the GPSD project, December 2009 +''' + +# Use our own MAXCHANNELS value, due to the tradeoff between max sats and +# the window size. Ideally, this should be dynamic. +MAXCHANNELS = 20 + +# how to sort the Satellite List +# some of ("PRN","el","az","ss","used") with optional '-' to reverse sort +# by default, used at the top, then sort PRN +SKY_VIEW_SORT_FIELDS = ('-used', 'PRN') + + +class unit_adjustments(object): + "Encapsulate adjustments for unit systems." + + def __init__(self, units=None): + self.altfactor = 1.0 + self.altunits = "m" + self.speedfactor = gps.MPS_TO_KPH + self.speedunits = "kph" + if units is None: + units = gps.clienthelpers.gpsd_units() + if units in (gps.clienthelpers.unspecified, gps.clienthelpers.imperial, + "imperial", "i"): + pass + elif units in (gps.clienthelpers.nautical, "nautical", "n"): + self.altfactor = gps.METERS_TO_FEET + self.altunits = "ft" + self.speedfactor = gps.MPS_TO_KNOTS + self.speedunits = "knots" + elif units in (gps.clienthelpers.metric, "metric", "m"): + self.altfactor = 1.0 + self.altunits = "m" + self.speedfactor = gps.MPS_TO_KPH + self.speedunits = "kph" + else: + raise ValueError # Should never happen + + +def fit_to_grid(x, y, line_width): + "Adjust coordinates to produce sharp lines." + if line_width % 1.0 != 0: + # Can't have sharp lines for non-integral line widths. + return float(x), float(y) # Be consistent about returning floats + if line_width % 2 == 0: + # Round to a pixel corner. + return round(x), round(y) + else: + # Round to a pixel center. + return int(x) + 0.5, int(y) + 0.5 + + +def fit_circle_to_grid(x, y, radius, line_width): + """Adjust circle coordinates and radius to produce sharp horizontal + and vertical tangents.""" + r = radius + x1, y1 = fit_to_grid(x - r, y - r, line_width) + x2, y2 = fit_to_grid(x + r, y + r, line_width) + x, y = (x1 + x2) / 2, (y1 + y2) / 2 + r = (x2 - x1 + y2 - y1) / 4 + return x, y, r + + +class SkyView(Gtk.DrawingArea): + "Satellite skyview, encapsulates pygtk's draw-on-expose behavior." + # See + HORIZON_PAD = 40 # How much whitespace to leave around horizon + SAT_RADIUS = 5 # Diameter of satellite circle + + def __init__(self, rotate=0.0): + Gtk.DrawingArea.__init__(self) + # GObject.GObject.__init__(self) + self.set_size_request(400, 400) + self.cr = None # New cairo context for each expose event + self.step_of_grid = 30 # default step of polar grid + self.connect('size-allocate', self.on_size_allocate) + self.connect('draw', self.on_draw) + self.satellites = [] + self.center_x = self.center_y = self.radius = None + self.rotate = rotate + + def on_size_allocate(self, _unused, allocation): + width = allocation.width + height = allocation.height + x = width // 2 + y = height // 2 + r = (min(width, height) - SkyView.HORIZON_PAD) // 2 + x, y, r = fit_circle_to_grid(x, y, r, 1) + self.center_x = x + self.center_y = y + self.radius = r + + def set_color(self, spec): + "Set foreground color for drawing." + gdkcolor = Gdk.color_parse(spec) + r = gdkcolor.red / 65535.0 + g = gdkcolor.green / 65535.0 + b = gdkcolor.blue / 65535.0 + self.cr.set_source_rgb(r, g, b) + + def draw_circle(self, x, y, radius, filled=False): + "Draw a circle centered on the specified midpoint." + lw = self.cr.get_line_width() + r = int(2 * radius + 0.5) // 2 + + x, y, r = fit_circle_to_grid(x, y, radius, lw) + + self.cr.arc(x, y, r, 0, math.pi * 2.0) + self.cr.close_path() + + if filled: + self.cr.fill() + else: + self.cr.stroke() + + def draw_line(self, x1, y1, x2, y2): + "Draw a line between specified points." + lw = self.cr.get_line_width() + x1, y1 = fit_to_grid(x1, y1, lw) + x2, y2 = fit_to_grid(x2, y2, lw) + + self.cr.move_to(x1, y1) + self.cr.line_to(x2, y2) + + self.cr.stroke() + + def draw_square(self, x, y, radius, filled=False): + "Draw a square centered on the specified midpoint." + lw = self.cr.get_line_width() + x1, y1 = fit_to_grid(x - radius, y - radius, lw) + x2, y2 = fit_to_grid(x + radius, y + radius, lw) + + self.cr.rectangle(x1, y1, x2 - x1, y2 - y1) + + if filled: + self.cr.fill() + else: + self.cr.stroke() + + def draw_string(self, x, y, text, centered=True): + "Draw a text on the skyview." + self.cr.select_font_face("Sans", cairo.FONT_SLANT_NORMAL, + cairo.FONT_WEIGHT_BOLD) + self.cr.set_font_size(10) + + if centered: + extents = self.cr.text_extents(text) + # width / 2 + x_bearing + x -= extents[2] / 2 + extents[0] + # height / 2 + y_bearing + y -= extents[3] / 2 + extents[1] + + self.cr.move_to(x, y) + self.cr.show_text(text) + self.cr.new_path() + + def pol2cart(self, az, el): + "Polar to Cartesian coordinates within the horizon circle." + az = (az - self.rotate) % 360.0 + az *= (math.pi / 180) # Degrees to radians + # Exact spherical projection would be like this: + # el = sin((90.0 - el) * DEG_2_RAD); + el = ((90.0 - el) / 90.0) + xout = self.center_x + math.sin(az) * el * self.radius + yout = self.center_y - math.cos(az) * el * self.radius + return (xout, yout) + + def on_draw(self, widget, _unused): + self.cr = widget.get_window().cairo_create() + + self.cr.set_line_width(1) + + self.cr.set_source_rgb(0, 0, 0) + self.cr.paint() + + self.cr.set_source_rgb(1, 1, 1) + # The zenith marker + self.draw_circle(self.center_x, self.center_y, 6, filled=False) + + # The horizon circle + if self.step_of_grid == 45: + # The circle corresponding to 45 degrees elevation. + # There are two ways we could plot this. Projecting the sphere + # on the display plane, the circle would have a diameter of + # sin(45) ~ 0.7. But the naive linear mapping, just splitting + # the horizon diameter in half, seems to work better visually. + self.draw_circle(self.center_x, self.center_y, self.radius / 2, + filled=False) + elif self.step_of_grid == 30: + self.draw_circle(self.center_x, self.center_y, self.radius * 2 / 3, + filled=False) + self.draw_circle(self.center_x, self.center_y, self.radius / 3, + filled=False) + self.draw_circle(self.center_x, self.center_y, self.radius, + filled=False) + + (x1, y1) = self.pol2cart(0, 0) + (x2, y2) = self.pol2cart(180, 0) + self.draw_line(x1, y1, x2, y2) + + (x1, y1) = self.pol2cart(90, 0) + (x2, y2) = self.pol2cart(270, 0) + self.draw_line(x1, y1, x2, y2) + + # The compass-point letters + (x, y) = self.pol2cart(0, -5) + self.draw_string(x, y, "N") + (x, y) = self.pol2cart(90, -5) + self.draw_string(x, y, "E") + (x, y) = self.pol2cart(180, -5) + self.draw_string(x, y, "S") + (x, y) = self.pol2cart(270, -5) + self.draw_string(x, y, "W") + + # The satellites + self.cr.set_line_width(2) + for sat in self.satellites: + if sat.az == 0 and sat.el == 0: + continue # Skip satellites with unknown position + (x, y) = self.pol2cart(sat.az, sat.el) + if sat.ss < 10: + self.set_color("Gray") + elif sat.ss < 30: + self.set_color("Red") + elif sat.ss < 35: + self.set_color("Yellow") + elif sat.ss < 40: + self.set_color("Green3") + else: + self.set_color("Green1") + if gps.is_sbas(sat.PRN): + self.draw_square(x, y, SkyView.SAT_RADIUS, sat.used) + else: + self.draw_circle(x, y, SkyView.SAT_RADIUS, sat.used) + + self.cr.set_source_rgb(1, 1, 1) + self.draw_string(x + SkyView.SAT_RADIUS, + y + (SkyView.SAT_RADIUS * 2), str(sat.PRN), + centered=False) + + self.cr = None + + def redraw(self, satellites): + "Redraw the skyview." + self.satellites = satellites + self.queue_draw() + + +class NoiseView(object): + "Encapsulate view object for watching noise statistics." + COLUMNS = 2 + ROWS = 4 + noisefields = ( + # First column + ("Time", "time"), + ("Latitude", "lat"), + ("Longitude", "lon"), + ("Altitude", "alt"), + # Second column + ("RMS", "rms"), + ("Major", "major"), + ("Minor", "minor"), + ("Orient", "orient"), + ) + + def __init__(self): + self.widget = Gtk.Table(NoiseView.COLUMNS, NoiseView.ROWS, False) + self.noisewidgets = [] + for i in range(len(NoiseView.noisefields)): + colbase = (i // NoiseView.ROWS) * 2 + label = Gtk.Label(label=NoiseView.noisefields[i][0] + ": ") + # Wacky way to force right alignment + label.set_alignment(xalign=1, yalign=0.5) + self.widget.attach( + label, colbase, colbase + 1, + i % NoiseView.ROWS, i % NoiseView.ROWS + 1) + entry = Gtk.Entry() + # The right size for the ISO8601 timestamp + entry.set_width_chars(20) + entry.set_text("n/a") + self.widget.attach( + entry, colbase + 1, colbase + 2, + i % NoiseView.ROWS, i % NoiseView.ROWS + 1) + self.noisewidgets.append((NoiseView.noisefields[i][1], entry)) + + def update(self, noise): + "Update the GPGST data fields." + for (attrname, widget) in self.noisewidgets: + if hasattr(noise, attrname): + widget.set_text(str(getattr(noise, attrname))) + else: + widget.set_text("n/a") + + +class MaidenheadView(object): + "Encapsulate view object for watching Maidenhead grid location." + + def __init__(self): + self.widget = Gtk.Entry() + self.widget.set_editable(False) + + def update(self, tpv): + if ((tpv.mode >= gps.MODE_2D + and hasattr(tpv, "lat") + and hasattr(tpv, "lon"))): + self.widget.set_text(gps.clienthelpers.maidenhead(tpv.lat, + tpv.lon)) + else: + return self.widget.set_text("n/a") + + +class AISView(object): + "Encapsulate store and view objects for watching AIS data." + AIS_ENTRIES = 10 + DWELLTIME = 360 + + def __init__(self, deg_type): + "Initialize the store and view." + self.deg_type = deg_type + self.name_to_mmsi = {} + self.named = {} + self.store = Gtk.ListStore(str, str, str, str, str, str) + self.widget = Gtk.ScrolledWindow() + self.widget.set_policy(Gtk.PolicyType.AUTOMATIC, + Gtk.PolicyType.AUTOMATIC) + self.view = Gtk.TreeView(model=self.store) + self.widget.set_size_request(-1, 300) + self.widget.add_with_viewport(self.view) + + for (i, label) in enumerate(('#', 'Name:', 'Callsign:', + 'Destination:', "Lat/Lon:", + "Information")): + column = Gtk.TreeViewColumn(label) + renderer = Gtk.CellRendererText() + column.pack_start(renderer, expand=True) + column.add_attribute(renderer, 'text', i) + self.view.append_column(column) + + def enter(self, ais, name): + "Add a named object (ship or station) to the store." + if ais.mmsi in self.named: + return False + else: + ais.entry_time = time.time() + self.named[ais.mmsi] = ais + self.name_to_mmsi[name] = ais.mmsi + # Garbage-collect old entries + try: + for i in range(len(self.store)): + here = self.store.get_iter(i) + name = self.store.get_value(here, 1) + mmsi = self.name_to_mmsi[name] + if ((self.named[mmsi].entry_time + < time.time() - AISView.DWELLTIME)): + del self.named[mmsi] + if name in self.name_to_mmsi: + del self.name_to_mmsi[name] + self.store.remove(here) + except (ValueError, KeyError): # Invalid TreeIters throw these + pass + return True + + def latlon(self, lat, lon): + "Latitude/longitude display in nice format." + if lat < 0: + latsuff = "S" + elif lat > 0: + latsuff = "N" + else: + latsuff = "" + lat = abs(lat) + lat = gps.clienthelpers.deg_to_str(self.deg_type, lat) + if lon < 0: + lonsuff = "W" + elif lon > 0: + lonsuff = "E" + else: + lonsuff = "" + lon = abs(lon) + lon = gps.clienthelpers.deg_to_str(gps.clienthelpers.deg_ddmmss, lon) + return lat + latsuff + "/" + lon + lonsuff + + def update(self, ais): + "Update the AIS data fields." + if ais.type in (1, 2, 3, 18): + if ais.mmsi in self.named: + for i in range(len(self.store)): + here = self.store.get_iter(i) + name = self.store.get_value(here, 1) + if name in self.name_to_mmsi: + mmsi = self.name_to_mmsi[name] + if mmsi == ais.mmsi: + latlon = self.latlon(ais.lat, ais.lon) + self.store.set_value(here, 4, latlon) + elif ais.type == 4: + if self.enter(ais, ais.mmsi): + where = self.latlon(ais.lat, ais.lon) + self.store.prepend( + (ais.type, ais.mmsi, "(shore)", ais.timestamp, where, + ais.epfd_text)) + elif ais.type == 5: + if self.enter(ais, ais.shipname): + self.store.prepend( + (ais.type, ais.shipname, ais.callsign, ais.destination, + "", ais.shiptype)) + elif ais.type == 12: + sender = ais.mmsi + if sender in self.named: + sender = self.named[sender].shipname + recipient = ais.dest_mmsi + if ((recipient in self.named + and hasattr(self.named[recipient], "shipname"))): + recipient = self.named[recipient].shipname + self.store.prepend( + (ais.type, sender, "", recipient, "", ais.text)) + elif ais.type == 14: + sender = ais.mmsi + if sender in self.named: + sender = self.named[sender].shipname + self.store.prepend( + (ais.type, sender, "", "(broadcast)", "", ais.text)) + elif ais.type in (19, 24): + if self.enter(ais, ais.shipname): + self.store.prepend( + (ais.type, ais.shipname, "(class B)", "", "", + ais.shiptype_text)) + elif ais.type == 21: + if self.enter(ais, ais.name): + where = self.latlon(ais.lat, ais.lon) + self.store.prepend( + (ais.type, ais.name, "(%s navaid)" % ais.epfd_text, + "", where, ais.aid_type_text)) + + +class Base(object): + COLUMNS = 3 + ROWS = 7 + gpsfields = ( + # First column + ("Time", lambda s, r: s.update_time(r)), + ("Latitude", lambda s, r: s.update_latitude(r)), + ("Longitude", lambda s, r: s.update_longitude(r)), + ("Altitude", lambda s, r: s.update_altitude(r)), + ("Speed", lambda s, r: s.update_speed(r)), + ("Climb", lambda s, r: s.update_climb(r)), + ("Track", lambda s, r: s.update_track(r)), + # Second column + ("Status", lambda s, r: s.update_status(r)), + ("EPX", lambda s, r: s.update_err(r, "epx")), + ("EPY", lambda s, r: s.update_err(r, "epy")), + ("EPV", lambda s, r: s.update_err(r, "epv")), + ("EPS", lambda s, r: s.update_err_speed(r, "eps")), + ("EPC", lambda s, r: s.update_err_speed(r, "epc")), + ("EPD", lambda s, r: s.update_err_degrees(r, "epd")), + ) + + def __init__(self, deg_type, rotate=0.0, target=""): + self.deg_type = deg_type + self.rotate = rotate + self.conversions = unit_adjustments() + self.saved_mode = -1 + self.ais_latch = False + self.noise_latch = False + + self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL) + if not self.window.get_display(): + raise Exception("Can't open display") + if len(target): + target = " " + target + self.window.set_title("xgps" + target) + self.window.connect("delete-event", self.delete_event) + self.window.set_resizable(False) + + vbox = Gtk.VBox(False, 0) + self.window.add(vbox) + + self.window.connect("destroy", lambda _unused: Gtk.main_quit()) + + self.uimanager = Gtk.UIManager() + self.accelgroup = self.uimanager.get_accel_group() + self.window.add_accel_group(self.accelgroup) + self.actiongroup = Gtk.ActionGroup('xgps') + self.actiongroup.add_actions( + [('Quit', Gtk.STOCK_QUIT, '_Quit', None, + 'Quit the Program', lambda _unused: Gtk.main_quit()), + ('File', None, '_File'), + ('View', None, '_View'), + ('Units', None, '_Units'), + ('Step of grid', None, '_Step of grid')]) + self.actiongroup.add_toggle_actions( + [('Skyview', None, '_Skyview', 's', + 'Enable Skyview', self.view_toggle), + ('Responses', None, '_Responses', 'r', + 'Enable Response Reports', self.view_toggle), + ('GPS', None, '_GPS Data', 'g', + 'Enable GPS Data', self.view_toggle), + ('Noise', None, '_Noise Statistics', 'n', + 'Enable Noise Statistics', self.view_toggle), + ('Maidenhead', None, '_Maidenhead', 'm', + 'Enable Maidenhead locator', self.view_toggle), + ('AIS', None, '_AIS Data', 'a', + 'Enable AIS Data', self.view_toggle), + ]) + self.actiongroup.add_radio_actions( + [('Imperial', None, '_Imperial', 'i', + 'Imperial units', 0), + ('Nautical', None, '_Nautical', 'n', + 'Nautical units', 1), + ('Metric', None, '_Metric', 'm', + 'Metric Units', 2), + ], 2, lambda a, _unused: self.set_units( + ['i', 'n', 'm'][a.get_current_value()])) + self.actiongroup.add_radio_actions( + [('30deg', None, '30°', None, '30°', 30), + ('45deg', None, '45°', None, '45°', 45), + ('Off', None, 'Off', None, 'Off', 0), + ], 30, lambda a, _unused: self.set_step_of_grid( + a.get_current_value())) + self.uimanager.insert_action_group(self.actiongroup, 0) + self.uimanager.add_ui_from_string(''' + + + + + + + + + + + + + + + + + + + + + + + + + +''') + self.uimanager.get_widget('/MenuBar/View/Skyview').set_active(True) + self.uimanager.get_widget('/MenuBar/View/Responses').set_active(True) + self.uimanager.get_widget('/MenuBar/View/GPS').set_active(True) + self.uimanager.get_widget('/MenuBar/View/Noise').set_active(True) + self.uimanager.get_widget('/MenuBar/View/Maidenhead').set_active(True) + self.uimanager.get_widget('/MenuBar/View/AIS').set_active(True) + menubar = self.uimanager.get_widget('/MenuBar') + vbox.pack_start(menubar, expand=False, fill=True, padding=0) + + self.satbox = Gtk.HBox(False, 0) + vbox.add(self.satbox) + + skyframe = Gtk.Frame(label="Satellite List") + self.satbox.add(skyframe) + + self.satlist = Gtk.ListStore(str, str, str, str, str) + view = Gtk.TreeView(model=self.satlist) + + for (i, label) in enumerate(('PRN:', 'Elev:', 'Azim:', 'SNR:', + 'Used:')): + column = Gtk.TreeViewColumn(label) + renderer = Gtk.CellRendererText() + column.pack_start(renderer, expand=True) + column.add_attribute(renderer, 'text', i) + view.append_column(column) + + self.row_iters = [] + for i in range(MAXCHANNELS): + self.satlist.append(["", "", "", "", ""]) + self.row_iters.append(self.satlist.get_iter(i)) + + skyframe.add(view) + + viewframe = Gtk.Frame(label="Skyview") + self.satbox.add(viewframe) + self.skyview = SkyView(self.rotate) + viewframe.add(self.skyview) + + self.rawdisplay = Gtk.Entry() + self.rawdisplay.set_editable(False) + vbox.add(self.rawdisplay) + + self.dataframe = Gtk.Frame(label="GPS data") + datatable = Gtk.Table(Base.COLUMNS, Base.ROWS, False) + self.dataframe.add(datatable) + gpswidgets = [] + for i in range(len(Base.gpsfields)): + colbase = (i // Base.ROWS) * 2 + label = Gtk.Label(label=Base.gpsfields[i][0] + ": ") + # Wacky way to force right alignment + label.set_alignment(xalign=1, yalign=0.5) + datatable.attach(label, colbase, colbase + 1, + i % Base.ROWS, i % Base.ROWS + 1) + entry = Gtk.Entry() + # The right size for the ISO8601 timestamp + entry.set_width_chars(20) + entry.set_text("n/a") + datatable.attach(entry, colbase + 1, colbase + 2, + i % Base.ROWS, i % Base.ROWS + 1) + gpswidgets.append(entry) + vbox.add(self.dataframe) + + self.noisebox = Gtk.HBox(False, 0) + vbox.add(self.noisebox) + noiseframe = Gtk.Frame(label="Noise Statistics") + self.noisebox.add(noiseframe) + self.noiseview = NoiseView() + noiseframe.add(self.noiseview.widget) + + self.gsbox = Gtk.HBox(False, 0) + vbox.add(self.gsbox) + gsframe = Gtk.Frame(label="Maidenhead Grid Square") + self.gsbox.add(gsframe) + self.gsview = MaidenheadView() + gsframe.add(self.gsview.widget) + + self.aisbox = Gtk.HBox(False, 0) + vbox.add(self.aisbox) + aisframe = Gtk.Frame(label="AIS Data") + self.aisbox.add(aisframe) + self.aisview = AISView(self.deg_type) + aisframe.add(self.aisview.widget) + + self.window.show_all() + # Hide the Noise Statistics window until user selects it. + self.uimanager.get_widget('/MenuBar/View/Noise').set_active(False) + self.noisebox.hide() + # Hide the Maidenhead window until user selects it. + self.uimanager.get_widget('/MenuBar/View/Maidenhead').set_active(False) + self.gsbox.hide() + # Hide the AIS window until user selects it. + self.uimanager.get_widget('/MenuBar/View/AIS').set_active(False) + self.aisbox.hide() + + self.view_name_to_widget = { + "Skyview": self.satbox, + "Responses": self.rawdisplay, + "GPS": self.dataframe, + "Noise": self.noisebox, + "Maidenhead": self.gsbox, + "AIS": self.aisbox} + + # Discard field labels and associate data hooks with their widgets + Base.gpsfields = [(label_hook_widget[0][1], label_hook_widget[1]) + for label_hook_widget + in zip(Base.gpsfields, gpswidgets)] + + def view_toggle(self, action): + # print("View toggle:", action.get_active(), action.get_name()) + if hasattr(self, 'view_name_to_widget'): + if action.get_active(): + self.view_name_to_widget[action.get_name()].show() + else: + self.view_name_to_widget[action.get_name()].hide() + # The effect we're after is to make the top-level window + # resize itself to fit when we show or hide widgets. + # This is undocumented magic to do that. + self.window.resize(1, 1) + + def set_satlist_field(self, row, column, value): + "Set a specified field in the satellite list." + try: + self.satlist.set_value(self.row_iters[row], column, str(value)) + except IndexError: + sys.stderr.write("xgps: channel = %d, MAXCHANNELS = %d\n" + % (row, MAXCHANNELS)) + + def delete_event(self, _widget, _event, _data=None): + Gtk.main_quit() + return False + + # State updates + + def update_time(self, data): + if hasattr(data, "time"): + # str() just in case we get an old-style float. + return str(data.time) + else: + return "n/a" + + def update_latitude(self, data): + if data.mode >= gps.MODE_2D and hasattr(data, "lat"): + lat = gps.clienthelpers.deg_to_str(self.deg_type, abs(data.lat)) + if data.lat < 0: + ns = 'S' + else: + ns = 'N' + return "%s %s" % (lat, ns) + else: + return "n/a" + + def update_longitude(self, data): + if data.mode >= gps.MODE_2D and hasattr(data, "lon"): + lon = gps.clienthelpers.deg_to_str(self.deg_type, abs(data.lon)) + if data.lon < 0: + ew = 'W' + else: + ew = 'E' + return "%s %s" % (lon, ew) + else: + return "n/a" + + def update_altitude(self, data): + if data.mode >= gps.MODE_3D and hasattr(data, "alt"): + return "%.3f %s" % ( + data.alt * self.conversions.altfactor, + self.conversions.altunits) + else: + return "n/a" + + def update_speed(self, data): + if hasattr(data, "speed"): + return "%.3f %s" % ( + data.speed * self.conversions.speedfactor, + self.conversions.speedunits) + else: + return "n/a" + + def update_climb(self, data): + if hasattr(data, "climb"): + return "%.3f %s" % ( + data.climb * self.conversions.speedfactor, + self.conversions.speedunits) + else: + return "n/a" + + def update_track(self, data): + if hasattr(data, "track"): + return gps.clienthelpers.deg_to_str(self.deg_type, abs(data.track)) + else: + return "n/a" + + def update_err(self, data, errtype): + if hasattr(data, errtype): + return "%.3f %s" % ( + getattr(data, errtype) * self.conversions.altfactor, + self.conversions.altunits) + else: + return "n/a" + + def update_err_speed(self, data, errtype): + if hasattr(data, errtype): + return "%.3f %s" % ( + getattr(data, errtype) * self.conversions.speedfactor, + self.conversions.speedunits) + else: + return "n/a" + + def update_err_degrees(self, data, errtype): + if hasattr(data, errtype): + return "%.3f °" % (getattr(data, errtype)) + else: + return "n/a" + + def update_status(self, data): + if data.mode == gps.MODE_2D: + status = "2D FIX" + elif data.mode == gps.MODE_3D: + status = "3D FIX" + else: + status = "NO FIX" + + if hasattr(data, 'status') and data.status == gps.STATUS_DGPS_FIX: + status += " DIFF" + if data.mode != self.saved_mode: + self.last_transition = time.time() + self.saved_mode = data.mode + return status + " (%d secs)" % (time.time() - self.last_transition) + + def update_gpsdata(self, tpv): + "Update the GPS data fields." + # the first 14 fields are updated using TPV data + for (hook, widget) in Base.gpsfields[:14]: + if hook: # Remove this guard when we have all hooks + widget.set_text(hook(self, tpv)) + self.gsview.update(tpv) + + def update_skyview(self, data): + "Update the satellite list and skyview." + if hasattr(data, 'satellites'): + satellites = data.satellites + for fld in reversed(SKY_VIEW_SORT_FIELDS): + rev = (fld[0] == '-') + if rev: + fld = fld[1:] + satellites = sorted( + satellites[:], + key=lambda x: x[fld], reverse=rev) + + for (i, satellite) in enumerate(satellites): + self.set_satlist_field(i, 0, satellite.PRN) + self.set_satlist_field(i, 1, satellite.el) + self.set_satlist_field(i, 2, satellite.az) + self.set_satlist_field(i, 3, satellite.ss) + yesno = 'N' + if satellite.used: + yesno = 'Y' + self.set_satlist_field(i, 4, yesno) + for i in range(len(satellites), MAXCHANNELS): + for j in range(0, 5): + self.set_satlist_field(i, j, "") + self.skyview.redraw(satellites) + + # Preferences + + def set_units(self, system): + "Change the display units." + self.conversions = unit_adjustments(system) + + def set_step_of_grid(self, system): + "Change the step of grid." + self.skyview.step_of_grid = system + + # I/O monitoring and gtk housekeeping + + def watch(self, daemon, device): + "Set up monitoring of a daemon instance." + self.daemon = daemon + self.device = device + GObject.io_add_watch(daemon.sock, GObject.IO_IN, self.handle_response) + GObject.io_add_watch(daemon.sock, GObject.IO_ERR, self.handle_hangup) + GObject.io_add_watch(daemon.sock, GObject.IO_HUP, self.handle_hangup) + + def handle_response(self, source, condition): + "Handle ordinary I/O ready condition from the daemon." + if self.daemon.read() == -1: + self.handle_hangup(source, condition) + if self.daemon.valid & gps.PACKET_SET: + if ((self.device + and "device" in self.daemon.data + and self.device != self.daemon.data["device"])): + return True + self.rawdisplay.set_text(self.daemon.response.strip()) + if self.daemon.data["class"] == "SKY": + self.update_skyview(self.daemon.data) + elif self.daemon.data["class"] == "TPV": + self.update_gpsdata(self.daemon.data) + elif self.daemon.data["class"] == "GST": + self.noiseview.update(self.daemon.data) + if not self.noise_latch: + self.noise_latch = True + self.uimanager.get_widget( + '/MenuBar/View/Noise').set_active(True) + self.noisebox.show() + elif self.daemon.data["class"] == "AIS": + self.aisview.update(self.daemon.data) + if not self.ais_latch: + self.ais_latch = True + self.uimanager.get_widget( + '/MenuBar/View/AIS').set_active(True) + self.aisbox.show() + + return True + + def handle_hangup(self, _source, _condition): + "Handle hangup condition from the daemon." + w = Gtk.MessageDialog(parent=self.window, + type=Gtk.MessageType.ERROR, + flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, + buttons=Gtk.ButtonsType.CANCEL) + w.connect("destroy", lambda _unused: Gtk.main_quit()) + w.set_markup("gpsd has stopped sending data.") + w.run() + Gtk.main_quit() + return True + + def main(self): + Gtk.main() + +if __name__ == "__main__": + try: + import getopt + (options, arguments) = getopt.getopt(sys.argv[1:], "D:hl:u:r:V?", + ['verbose']) + debug = 0 + degreefmt = 'd' + unit_system = None + rotate = 0.0 + for (opt, val) in options: + if opt in '-D': + debug = int(val) + elif opt == '-l': + degreeformat = val + elif opt == '-u': + unit_system = val + elif opt == '-r': + try: + rotate = float(val) + except ValueError: + rotate = 0.0 + elif opt in ('-?', '-h', '--help'): + print(__doc__) + sys.exit(0) + elif opt == 'V': + sys.stderr.write("xgps 1.0\n") + sys.exit(0) + + degreefmt = {'d': gps.clienthelpers.deg_dd, + 'm': gps.clienthelpers.deg_ddmm, + 's': gps.clienthelpers.deg_ddmmss}[degreefmt] + + (host, port, device) = ("localhost", gps.GPSD_PORT, None) + if len(arguments): + args = arguments[0].split(":") + if len(args) >= 1 and args[0]: + host = args[0] + if len(args) >= 2 and args[1]: + port = args[1] + if len(args) >= 3: + device = args[2] + target = ":".join(arguments[0:]) + else: + target = "" + + base = Base(deg_type=degreefmt, rotate=rotate, target=target) + base.set_units(unit_system) + try: + daemon = gps.gps(host=host, + port=port, + mode=gps.WATCH_ENABLE | gps.WATCH_JSON + | gps.WATCH_SCALED, + verbose=debug) + base.watch(daemon, device) + base.main() + except socket.error: + w = Gtk.MessageDialog(parent=base.window, + type=Gtk.MessageType.ERROR, + flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, + buttons=Gtk.ButtonsType.CANCEL) + w.set_markup("gpsd is not running.") + w.run() + w.destroy() + except KeyboardInterrupt: + pass diff --git a/docs/linux-commands.png b/docs/linux-commands.png new file mode 100644 index 0000000..3b01df5 Binary files /dev/null and b/docs/linux-commands.png differ diff --git a/dot/bashrc b/dot/bashrc new file mode 100644 index 0000000..181866d --- /dev/null +++ b/dot/bashrc @@ -0,0 +1,68 @@ +# NTCNA V2X development + +# Python VirtualEnv +if [ -x /usr/local/bin/virtualenvwrapper.sh ]; then + VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 + source /usr/local/bin/virtualenvwrapper.sh +fi + +# Android Studio +if [ -d ~/android-studio ]; then + export PATH=$PATH:~/android-studio/bin +fi + +# Marben ASN.1 compiler +if [ -d /opt/marben/asnsdk ]; then + export ASNSDK_TCE_DIR=/opt/marben/asnsdk/TCE-C_V61/Compiler + export PATH=$ASNSDK_TCE_DIR/bin:$PATH +fi + +# ROS 1 +if [ -f /opt/ros/noetic/setup.bash ]; then + # 20.04 + source /opt/ros/noetic/setup.bash + PYTHONPATH=$PYTHONPATH:$HOME/catkin_ws/devel/lib/python3/dist-packages +elif [ -f /opt/ros/melodic/setup.bash ]; then + # 16.04/18.04 + source /opt/ros/melodic/setup.bash +fi + +# ROS 2 +#if [ -f /opt/ros/foxy/setup.bash ]; then + # 20.04 +# source /opt/ros/foxy/setup.bash +#fi + +# ProbeStar C/C++ library +if [ -d /usr/local/cnomicon ]; then + export PATH=$PATH:/usr/local/cnomicon/bin:/usr/local/cnomicon/sbin +fi +# NTCNA V2X C/C++ library +if [ -d /usr/local/cvehicle ]; then + export PATH=$PATH:/usr/local/cvehicle/bin:/usr/local/cvehicle/sbin +fi + +# ProbeStar Python classes +if [ -d $HOME/Pynomicon/classes ]; then + export PYTHONPATH=$PYTHONPATH:$HOME/Pynomicon/classes +fi +# NTCNA V2X Python classes (install pycrate), ROS path above +if [ -d $HOME/PyVehicle/classes ]; then + export PYTHONPATH=$PYTHONPATH:$HOME/PyVehicle/classes:$HOME/PyVehicle/classes/j2735 +fi + +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then + . "/opt/anaconda3/etc/profile.d/conda.sh" + else + export PATH="/opt/anaconda3/bin:$PATH" + fi +fi +unset __conda_setup +# <<< conda initialize <<< + diff --git a/dot/unison/archive.prf b/dot/unison/archive.prf new file mode 100644 index 0000000..5df06cf --- /dev/null +++ b/dot/unison/archive.prf @@ -0,0 +1,25 @@ +# Two root directories to sync. +# You can use ssh:// to sync over SSH +root = /home/neal/Archive +root = ssh://neal@babylon5.probestar.com:2829//home/neal/Archive + +# If you want one-way mirroring from one replica to the other, specify the source replica using "force" as follows. +# force = /home/alice/sync_folder + +# If you want Unison to run without any user input, try "batch" mode. +batch = true + +# If you don't want to be prompted, and just accept Unison's recommendation: +auto = true + +# Optionally, you can sync specific sub directories only (under the root). +# path = dir1 +# path = dir2 + +# Optionally, you can ignore specific files or directories that are matched with regular expressions. +ignore = Name *.o +ignore = Name *~ +# ignore = Path */temp/archive_* + +# If you want to ignore difference in file props: +perms = 0 diff --git a/dot/unison/projects.prf b/dot/unison/projects.prf new file mode 100644 index 0000000..e172366 --- /dev/null +++ b/dot/unison/projects.prf @@ -0,0 +1,25 @@ +# Two root directories to sync. +# You can use ssh:// to sync over SSH +root = /home/neal/Projects +root = ssh://neal@babylon5.probestar.com:2829//home/neal/Projects + +# If you want one-way mirroring from one replica to the other, specify the source replica using "force" as follows. +# force = /home/alice/sync_folder + +# If you want Unison to run without any user input, try "batch" mode. +batch = true + +# If you don't want to be prompted, and just accept Unison's recommendation: +auto = true + +# Optionally, you can sync specific sub directories only (under the root). +# path = dir1 +# path = dir2 + +# Optionally, you can ignore specific files or directories that are matched with regular expressions. +ignore = Name *.o +ignore = Name *~ +# ignore = Path */temp/archive_* + +# If you want to ignore difference in file props: +perms = 0 diff --git a/dot/unison/testing.prf b/dot/unison/testing.prf new file mode 100644 index 0000000..e4aaec0 --- /dev/null +++ b/dot/unison/testing.prf @@ -0,0 +1,25 @@ +# Two root directories to sync. +# You can use ssh:// to sync over SSH +root = /home/neal/Testing +root = ssh://neal@babylon5.probestar.com//home/neal/Testing + +# If you want one-way mirroring from one replica to the other, specify the source replica using "force" as follows. +# force = /home/alice/sync_folder + +# If you want Unison to run without any user input, try "batch" mode. +batch = true + +# If you don't want to be prompted, and just accept Unison's recommendation: +auto = true + +# Optionally, you can sync specific sub directories only (under the root). +# path = dir1 +# path = dir2 + +# Optionally, you can ignore specific files or directories that are matched with regular expressions. +ignore = Name *.o +ignore = Name *~ +# ignore = Path */temp/archive_* + +# If you want to ignore difference in file props: +perms = 0 diff --git a/dot/unison/xfer.prf b/dot/unison/xfer.prf new file mode 100644 index 0000000..1785e28 --- /dev/null +++ b/dot/unison/xfer.prf @@ -0,0 +1,25 @@ +# Two root directories to sync. +# You can use ssh:// to sync over SSH +root = /home/neal/Nxfer +root = ssh://neal@babylon5.probestar.com:2829//home/neal/Nxfer + +# If you want one-way mirroring from one replica to the other, specify the source replica using "force" as follows. +# force = /home/alice/sync_folder + +# If you want Unison to run without any user input, try "batch" mode. +batch = true + +# If you don't want to be prompted, and just accept Unison's recommendation: +auto = true + +# Optionally, you can sync specific sub directories only (under the root). +# path = dir1 +# path = dir2 + +# Optionally, you can ignore specific files or directories that are matched with regular expressions. +ignore = Name *.o +ignore = Name *~ +# ignore = Path */temp/archive_* + +# If you want to ignore difference in file props: +perms = 0 diff --git a/misc/qualcomm-pkgs.sh b/misc/qualcomm-pkgs.sh new file mode 100755 index 0000000..8faf71f --- /dev/null +++ b/misc/qualcomm-pkgs.sh @@ -0,0 +1,3 @@ +apt-get -y install texinfo chrpath libssl-dev libc6-dev g++-multilib +apt-get -y install git-core gettext diffstat gawk wget liblzo2-2 +apt-get -y install scons repo liblzo2-dev diff --git a/misc/wireshark-pkgs.sh b/misc/wireshark-pkgs.sh new file mode 100755 index 0000000..e429979 --- /dev/null +++ b/misc/wireshark-pkgs.sh @@ -0,0 +1,10 @@ +apt-get -y install ninja-build doxygen libcap-dev libpcap-dev libc-ares-dev +apt-get -y install libgcrypt20-dev libgcrypt11-dev libgnutls28-dev libkrb5-dev +apt-get -y install flex bison +apt-get -y install qttools5-dev qttools5-dev-tools libqt5svg5-dev qtmultimedia5-dev +apt-get -y install libnl-3-dev libnl-nf-3-dev libmaxminddb-dev libnl-genl-3-dev libnl-cli-3-dev +apt-get -y install libssh-dev libssh2-1-dev libnghttp2-dev liblz4-dev +apt-get -y install libjson-glib-dev libsnappy-dev libspandsp-dev json-glib-tools +apt-get -y install libxslt1-dev xsltproc asciidoctor +apt-get -y install libsmi2-dev libsbc-dev libsystemd-dev +apt-get -y install lua5.2 liblua5.2-dev diff --git a/rules.d/40-ubertooth.rules b/rules.d/40-ubertooth.rules new file mode 100644 index 0000000..31b6524 --- /dev/null +++ b/rules.d/40-ubertooth.rules @@ -0,0 +1,10 @@ +# Possible Ubertooth DFU +ATTRS{idVendor}=="ffff", ATTRS{idProduct}=="0004", MODE="0660", GROUP="plugdev" +# Ubertooth Zero +ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="6000", MODE="0660", GROUP="plugdev" +# Ubertooth Zero DFU +ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="6001", MODE="0660", GROUP="plugdev" +# Ubertooth One +ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="6002", MODE="0660", GROUP="plugdev" +# Ubertooth One DFU +ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="6003", MODE="0660", GROUP="plugdev" diff --git a/rules.d/53-hackrf.rules b/rules.d/53-hackrf.rules new file mode 100644 index 0000000..d60cf85 --- /dev/null +++ b/rules.d/53-hackrf.rules @@ -0,0 +1,4 @@ +ATTR{idVendor}=="1d50", ATTR{idProduct}=="604b", SYMLINK+="hackrf-jawbreaker-%k", MODE="666", GROUP="plugdev" +ATTR{idVendor}=="1d50", ATTR{idProduct}=="6089", SYMLINK+="hackrf-one-%k", MODE="666", GROUP="plugdev" +ATTR{idVendor}=="1d50", ATTR{idProduct}=="cc15", SYMLINK+="rad1o-%k", MODE="666", GROUP="plugdev" +ATTR{idVendor}=="1fc9", ATTR{idProduct}=="000c", SYMLINK+="nxp-dfu-%k", MODE="666", GROUP="plugdev" diff --git a/rules.d/77-bitscope.rules b/rules.d/77-bitscope.rules new file mode 100644 index 0000000..a84c7d2 --- /dev/null +++ b/rules.d/77-bitscope.rules @@ -0,0 +1,10 @@ +# Modem Manager must ignore BitScope/FTDI USB Serial Devices | 19838.02 + +ACTION!="add|change", GOTO="mm_usb_device_blacklist_end" +SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end" +ENV{DEVTYPE}!="usb_device", GOTO="mm_usb_device_blacklist_end" + +ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ENV{ID_MM_DEVICE_IGNORE}="1" + +LABEL="mm_usb_device_blacklist_end" + diff --git a/rules.d/99-rtl-sdr.rules b/rules.d/99-rtl-sdr.rules new file mode 100644 index 0000000..4213454 --- /dev/null +++ b/rules.d/99-rtl-sdr.rules @@ -0,0 +1,139 @@ +# +# Copyright 2012-2013 Osmocom rtl-sdr project +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# original RTL2832U vid/pid (hama nano, for example) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2832", MODE:="0666" + +# RTL2832U OEM vid/pid, e.g. ezcap EzTV668 (E4000), Newsky TV28T (E4000/R820T) etc. +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE:="0666" + +# DigitalNow Quad DVB-T PCI-E card (4x FC0012?) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0413", ATTRS{idProduct}=="6680", MODE:="0666" + +# Leadtek WinFast DTV Dongle mini D (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0413", ATTRS{idProduct}=="6f0f", MODE:="0666" + +# Genius TVGo DVB-T03 USB dongle (Ver. B) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0458", ATTRS{idProduct}=="707f", MODE:="0666" + +# Terratec Cinergy T Stick Black (rev 1) (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00a9", MODE:="0666" + +# Terratec NOXON rev 1 (FC0013) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b3", MODE:="0666" + +# Terratec Deutschlandradio DAB Stick (FC0013) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b4", MODE:="0666" + +# Terratec NOXON DAB Stick - Radio Energy (FC0013) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b5", MODE:="0666" + +# Terratec Media Broadcast DAB Stick (FC0013) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b7", MODE:="0666" + +# Terratec BR DAB Stick (FC0013) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b8", MODE:="0666" + +# Terratec WDR DAB Stick (FC0013) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b9", MODE:="0666" + +# Terratec MuellerVerlag DAB Stick (FC0013) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00c0", MODE:="0666" + +# Terratec Fraunhofer DAB Stick (FC0013) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00c6", MODE:="0666" + +# Terratec Cinergy T Stick RC (Rev.3) (E4000) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d3", MODE:="0666" + +# Terratec T Stick PLUS (E4000) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d7", MODE:="0666" + +# Terratec NOXON rev 2 (E4000) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00e0", MODE:="0666" + +# PixelView PV-DT235U(RN) (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1554", ATTRS{idProduct}=="5020", MODE:="0666" + +# Astrometa DVB-T/DVB-T2 (R828D) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="15f4", ATTRS{idProduct}=="0131", MODE:="0666" + +# Compro Videomate U620F (E4000) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0620", MODE:="0666" + +# Compro Videomate U650F (E4000) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0650", MODE:="0666" + +# Compro Videomate U680F (E4000) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0680", MODE:="0666" + +# GIGABYTE GT-U7300 (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d393", MODE:="0666" + +# DIKOM USB-DVBT HD +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d394", MODE:="0666" + +# Peak 102569AGPK (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d395", MODE:="0666" + +# KWorld KW-UB450-T USB DVB-T Pico TV (TUA9001) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d397", MODE:="0666" + +# Zaapa ZT-MINDVBZP (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d398", MODE:="0666" + +# SVEON STV20 DVB-T USB & FM (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d39d", MODE:="0666" + +# Twintech UT-40 (FC0013) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3a4", MODE:="0666" + +# ASUS U3100MINI_PLUS_V2 (FC0013) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3a8", MODE:="0666" + +# SVEON STV27 DVB-T USB & FM (FC0013) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3af", MODE:="0666" + +# SVEON STV21 DVB-T USB & FM +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3b0", MODE:="0666" + +# Dexatek DK DVB-T Dongle (Logilink VG0002A) (FC2580) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1101", MODE:="0666" + +# Dexatek DK DVB-T Dongle (MSI DigiVox mini II V3.0) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1102", MODE:="0666" + +# Dexatek DK 5217 DVB-T Dongle (FC2580) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1103", MODE:="0666" + +# MSI DigiVox Micro HD (FC2580) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1104", MODE:="0666" + +# Sweex DVB-T USB (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="a803", MODE:="0666" + +# GTek T803 (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="b803", MODE:="0666" + +# Lifeview LV5TDeluxe (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="c803", MODE:="0666" + +# MyGica TD312 (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="d286", MODE:="0666" + +# PROlectrix DV107669 (FC0012) +SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="d803", MODE:="0666" diff --git a/rules.d/99-saleae-logic-usb.rules b/rules.d/99-saleae-logic-usb.rules new file mode 100644 index 0000000..e989a4b --- /dev/null +++ b/rules.d/99-saleae-logic-usb.rules @@ -0,0 +1,15 @@ +# Rules for the Saleae Logic analyzer to allow to run the programs a normal user +# being part of the plugdev group. Simply copy the file to /etc/udev/rules.d/ +# and plug the device + +BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="saleae_logic_rules_end" + +# Saleae Logic analyzer (USB Based) +# Bus 006 Device 006: ID 0925:3881 Lakeview Research +# Bus 001 Device 009: ID 21a9:1004 Product: Logic S/16, Manufacturer: Saleae LLC + +ATTR{idVendor}=="0925", ATTR{idProduct}=="3881", MODE="664", GROUP="plugdev" +ATTR{idVendor}=="21a9", ATTR{idProduct}=="1004", MODE="664", GROUP="plugdev" + +LABEL="saleae_logic_rules_end" + diff --git a/sbin/apt-search b/sbin/apt-search new file mode 100755 index 0000000..03f0a27 --- /dev/null +++ b/sbin/apt-search @@ -0,0 +1,7 @@ +#!/bin/sh + +for i in $@ +do + apt-cache search $i | grep -i $i | more +done + diff --git a/sbin/linux-setup b/sbin/linux-setup new file mode 100755 index 0000000..8e35eb2 --- /dev/null +++ b/sbin/linux-setup @@ -0,0 +1,110 @@ +#!/bin/sh + +# little things +sudo adduser $USER dialout +sudo adduser $USER plugdev + +ver=`uname -r` +echo "Build packages:" +sudo apt-get install -y build-essential +sudo apt-get install -y linux-headers-$ver +echo + +# Must have +echo "Essentials:" +sudo apt-get install -y --ignore-missing git git-extras git-cola subversion subversion-tools openssh-server imagemagick bc ddd flip tcpdump zip unzip minicom netcat putty filezilla vlc terminator guake exfat-fuse exfat-utils openssh-server x11vnc xtightvncviewer geeqie okular ocaml +echo + +echo "Network:" +sudo apt-get install -y --ignore-missing nfs-common nfs-kernel-server net-tools chkrootkit secure-delete hashdeep kismet kismet-plugins netcat socat cryptcat dsniff etherape socat spectools tcpdump tshark wireshark nethogs wifite tcpreplay bittwist ethtool +echo + +echo "Bluetooth (install libbtbb and ubertooth manually):" +sudo apt-get install -y --ignore-missing bluez-tools bluez-tests bluez-hcidump ubertooth-firmware spectools bluedevil blueman bluewho btscanner +echo "" + +echo "Virtual:" +sudo apt-get install -y --ignore-missing docker docker.io qemu qemu-kvm qemu-user qemu-system qemu-utils virtualbox virtualbox-guest-additions-iso +echo + +sudo adduser $USER docker +echo "===========" + +# Development +echo "C/C++ Development:" +sudo apt-get install -y --ignore-missing libboost-dev libbz2-dev libgd-dev libmuparser-dev libmysqlclient-dev libxml2-dev xutils-dev libbz2-dev libkml-dev libmuparser-dev libmuparserx-dev liburiparser-dev libpopt-dev libpcap-dev libsodium-dev libxml2-dev mingw-w64 clang diffutils doxygen doxygen-gui graphviz patch ctags radare2 autoconf qt5-qmake qtbase5-dev kdevelop qt5-default qtcreator pyqt5-dev pyqt5-dev-tools protobuf-c-compiler protobuf-compiler cmake libjson-c-dev +echo + +echo "32 bit Development" +sudo apt-get install -y --ignore-missing libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 +echo + +echo "Java:" +sudo apt-get install -y --ignore-missing netbeans + +echo "Other languages:" +sudo apt-get install -y --ignore-missing golang julia lua5.3 rustc ruby-full +echo + +echo "Python 3 packages:" +sudo apt-get install -y --ignore-missing python3-all python3-pip python3-dev python3-tk idle3 spyder3 python3-numpy python3-serial python3-can virtualenv virtualenvwrapper +sudo apt-get install -y --ignore-missing python3-pil.imagetk glade python3-gi pyqt5-dev pyqt5-dev-tools +sudo -H pip install --upgrade pip + +for i in pyserial numpy pyasn1 matplotlib pyqt5 scapy pyside2 +do + echo $i + echo ----------- + sudo -H pip install $i +done +echo "==================" +echo + +# Packages +echo "Automotive CAN/GPS:" +sudo apt-get install -y --ignore-missing can-utils gis-gps gpsbabel gpsbabel-gui gpsman maptool marble navit viking gpsd gpsd-clients +echo + +echo "GNU/SDR Radio" +sudo apt-get install -y --ignore-missing airspy bladerf hackrf gnuradio gr-air-modes gr-fosphor gr-osmosdr gqrx-sdr inspectrum osmo-sdr rtl-sdr quisk librtlsdr-dev +echo + +echo "HAM Radio:" +sudo apt-get install -y --ignore-missing hamradio-antenna hamradio-datamodes hamradio-digitalvoice hamradio-logging hamradio-packetmodes hamradio-rigcontrol hamradio-satellite hamradio-sdr hamradio-tasks hamradio-tools icom chirp fldigi grig gpredict wsjtx +echo + +echo "Debian Science:" +#sudo apt-get install -y --ignore-missing science-astronomy science-electronics science-engineering science-mathematics science-physics science-viewing +sudo apt-get install -y --ignore-missing freemat scilab octave +echo + +echo "Cryptography:" +sudo apt-get install -y --ignore-missing codecrypt libsodium-dev libcrypto++-dev +echo + +echo "Embedded:" +sudo apt-get install -y --ignore-missing arduino avrdude avarice gdb-avr binutils-avr avr-libc crasm d52 pasmo sdcc sdcc-libraries as31 dis51 emu8051 mcu8051ide s51dude gcc-m68hc1x binutils-m68hc1x z80asm z80dasm libnewlib-dev flashrom openocd usbprog usbprog-gui setserial +echo + +echo "Robotics:" +sudo apt-get install -y --ignore-missing brickos lnpd nbc nqc +echo + +echo "Emulators:" +echo +sudo apt-get install -y --ignore-missing bochs bochsbios cpmtools dosbox dosemu wine-stable + +# Snap +#for i in pycharm-community +#do +# snap install $i --classic +#done + +# Cleanup +sudo apt-get autoremove +sudo apt-get clean + +# Tweaks +git config --global user.email "nprobert@probestar.net" +git config --global user.name "Neal Probert" +git config --global credential.helper store diff --git a/sbin/neal-setup b/sbin/neal-setup new file mode 100755 index 0000000..5c722fb --- /dev/null +++ b/sbin/neal-setup @@ -0,0 +1,56 @@ +#!/bin/sh + +# directories +cd $HOME +mkdir bin misc tmp Projects Gits + +# ProbeStar stuff +mkdir ProbeStar +cd ProbeStar +for i in Cnomicon CyberSecurity Database linux_tools Multimedia Pynomicon Radio Robotics +do + echo "ProbeStar: $i" + if [ -d $i ]; then + cd $i + git pull + git status + cd .. + else + git clone https://www.probestar.com/PStar/$i + fi + cd .. + ln -fs ProbeStar/$i + cd ProbeStar +done +cd $HOME +cp linux_tools/bin/* ~/bin + +# NTCNA stuff +cd $HOME +mkdir NTCNA +cd NTCNA +for i in CVehicle NissanV2X PyVehicle ProberN +do + echo "NTCNA: $i" + if [ -d $i ]; then + cd $i + git pull + cd .. + else + git clone https://www.probestar.com/NTCNA-TP/$i + fi +done +cd $HOME +for i in CVehicle NissanV2X PyVehicle ProberN +do + ln -fs NTCNA/$i $i +done + +exit 0 + +# Google +#cd Downloads +#echo "Google Chrome" +#wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb +#sudo dpkg -i google-chrome-stable_current_amd64.deb +#sudo apt-get -f install diff --git a/sbin/net-up b/sbin/net-up new file mode 100755 index 0000000..dc41729 --- /dev/null +++ b/sbin/net-up @@ -0,0 +1,3 @@ +#!/bin/sh + +ifconfig eth0:0 192.168.1.90 netmask 255.255.255.0 up diff --git a/sbin/pstar-tunnel b/sbin/pstar-tunnel new file mode 100755 index 0000000..0d59ce2 --- /dev/null +++ b/sbin/pstar-tunnel @@ -0,0 +1,5 @@ +#!/bin/sh + +COMMAND="ssh -p 2829 -N -f -R 10.1.1.11:2945:localhost:22 babylon5.probestar.com" +pgrep -f -x "$COMMAND" > /dev/null 2>&1 || $COMMAND + diff --git a/sbin/python-updates b/sbin/python-updates new file mode 100755 index 0000000..1ed571c --- /dev/null +++ b/sbin/python-updates @@ -0,0 +1,7 @@ +#!/bin/sh + +# Pip +sudo -H pip3 install --upgrade pip + +# Python3 +sudo -H pip3 install --upgrade pyserial numpy pyasn1 matplotlib pyside2 scapy virtualenv virtualenvwrapper diff --git a/sbin/server-setup b/sbin/server-setup new file mode 100755 index 0000000..0958131 --- /dev/null +++ b/sbin/server-setup @@ -0,0 +1,40 @@ +#!/bin/sh + +ver=`uname -r` +echo "Build packages:" +sudo apt-get install -y build-essential +#sudo apt-get install -y linux-headers +sudo apt-get install -y linux-headers-$ver +echo + +# Must have +echo "Essentials:" +sudo apt-get install -y --ignore-missing git subversion subversion-tools openssh-server imagemagick bc flip tcpdump zip unzip netcat +echo + +echo "Network:" +sudo apt-get install -y --ignore-missing net-tools chkrootkit denyhosts secure-delete hashdeep netcat socat cryptcat dsniff etherape socat tcpdump tshark +echo + +#echo "Virtual:" +#sudo apt-get install -y --ignore-missing docker docker.io qemu qemu-kvm qemu-launcher qemu-user qemu-system qemu-utils virtualbox virtualbox-guest-additions-iso +#echo + +echo "===========" + +# Development +echo "C/C++ Development:" +sudo apt-get install -y --ignore-missing libboost-dev libgd-dev libgd2-dev libgd2-xpm-dev libmuparser-dev libmysqlclient-dev libxml2-dev xutils-dev libbz2-dev libkml-dev liburiparser-dev libpopt-dev libpcap-dev libsodium-dev mingw-w64 clang diffutils patch ctags radare2 autoconf +echo + +echo "32 bit Development" +sudo apt-get install -y --ignore-missing libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 +echo + +echo "Cryptography:" +sudo apt-get install -y --ignore-missing codecrypt libsodium-dev libcrypto++-dev +echo + +# Cleanup +sudo apt-get autoremove +sudo apt-get clean diff --git a/sbin/service-close b/sbin/service-close new file mode 100755 index 0000000..2d8cada --- /dev/null +++ b/sbin/service-close @@ -0,0 +1,11 @@ +#!/bin/sh +if test $# -eq 0; then + echo usage: $( basename $0 ) service ... 1>&2 + exit 1 +fi +while test $# -ne 0; do + /usr/sbin/iptables -D INPUT -p tcp --dport "$1" -j ACCEPT + /usr/sbin/iptables -D INPUT -p udp --dport "$1" -j ACCEPT + shift +done + diff --git a/sbin/service-open b/sbin/service-open new file mode 100755 index 0000000..d242e22 --- /dev/null +++ b/sbin/service-open @@ -0,0 +1,11 @@ +#!/bin/sh +if test $# -eq 0; then + echo usage: $( basename $0 ) service ... 1>&2 + exit 1 +fi +while test $# -ne 0; do + /usr/sbin/iptables -A INPUT -p tcp --dport "$1" -j ACCEPT + /usr/sbin/iptables -A INPUT -p udp --dport "$1" -j ACCEPT + shift +done + diff --git a/sbin/silent-running b/sbin/silent-running new file mode 100755 index 0000000..bdf8773 --- /dev/null +++ b/sbin/silent-running @@ -0,0 +1,11 @@ +#!/bin/sh +iptables -P FORWARD DROP +iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +iptables -A INPUT -i lo -j ACCEPT +iptables -A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT +iptables -A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT +iptables -A INPUT -p icmp -m icmp --icmp-type 4 -j ACCEPT +iptables -A INPUT -p icmp -m icmp --icmp-type 12 -j ACCEPT +iptables -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP +iptables -P INPUT DROP + diff --git a/sbin/ssh-babylon5-setup b/sbin/ssh-babylon5-setup new file mode 100755 index 0000000..bcd608a --- /dev/null +++ b/sbin/ssh-babylon5-setup @@ -0,0 +1,6 @@ +#!/bin/sh + +# SSH +ssh-keygen +ssh-copy-id -i ~/.ssh/id_rsa.pub -p 2829 neal@babylon5.probestar.com + diff --git a/sbin/swap-increase b/sbin/swap-increase new file mode 100755 index 0000000..0539785 --- /dev/null +++ b/sbin/swap-increase @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ -f /swapfile ]; then + echo "Increasing /swapfile size" + swapoff /swapfile + rm /swapfile + fallocate -l 16G /swapfile + chmod 600 /swapfile + mkswap /swapfile + swapon /swapfile +else + echo "No /swapfile!" +fi