User Tools

Site Tools


blog:spring2016:dsaunde6:start

dan's spring2016 Opus

weekly ramblings from the dungeon

Introduction

In this space you can provide a description of yourself, your pursuits, your interests. To fill out this section, click the edit button off to the right, delete this placement text, and type your original content.

UNIX/Linux Fundamentals Journal

MONTH Day, YEAR

This is a sample format for a dated entry. Please substitute the actual date for “Month Day, Year”, and duplicate the level 4 heading to make additional entries.

As an aid, feel free to use the following questions to help you generate content for your entries:

  • What action or concept of significance, as related to the course, did you experience on this date?
  • Why was this significant?
  • What concepts are you dealing with that may not make perfect sense?
  • What challenges are you facing with respect to the course?

JANUARY 23, 2016

Mosh is worth a try

Ever used an SSH client on your mobile devices, only to have your connection cut out, and then your session goes haywire? It's frustrating and gets old really quick, and there's not much you can do to fix the problem with SSH. This, along with several other “flaws”, led to the creation of mosh, a remote shell system designed for the mobile world. Developers chose to make a new protocol at the terminal level called State Synchronization Protocol, build on top of UDP datagrams. This allowed them to have better control over how the data is handled, avoiding the complications TCP sometimes adds. Another set of issues that the shell fixes is “evil” Unicode sequences, where some UTF-8 patterns are known to either turn post-command output into hieroglyphs, or even lock up the terminal (the only way to reset the terminal is close it and open it back up). Response times are also improved. Read more here: https://mosh.mit.edu/

JANUARY 30, 2016

PFSense: A Sensible Free Solution to IOS & Co.

This week I decided to do some work on my aging home network, which relied on a Cisco/Linksys E1000 wireless router for routing all packets. It did a good job, except the fact it died on a weekly basis. And as it's known in IT - downtime is a bad, bad thing. I had to do something about it, and not having the money for enterprise hardware makes it fairly troublesome. For a while I had heard of PFSense, a FreeBSD-based router operating system with support for SSH, serial, and web controls. It has an insane amount of features in comparison to dd-wrt, the software that runs on the E1000 and WRT54G that help(ed) power my network. The only prerequisite in order to run PFSense on the Dell Optiplex GX280 I used was add a second ethernet port. Installing the OS was easy, and didn't take long at all. It consisted of:

  • Setting up passwords
  • Associating the ethernet ports with the WAN and LAN interfaces
  • Setting up a NAT subnet
  • ???
  • PROFIT!

All in all, PFSense has been really stable. It runs very light, even with OpenVPN and other add-ons installed. I would recommend it to anyone looking for a cost-effective solution to enterprise products.

FEBRUARY 7, 2016

IRC: A chat system that just works.

Most people are confused when you pose the term “IRC”, the acronym for Internet Relay Chat. However, those same people will know the term “chat room” - that term refers to an IRC channel. But why should you use it?

  • It's tried and true.
  • It's free.
  • You can start your own server should you want one.
  • Bots and helpers for it exist everywhere.
  • Twitch.tv is a notable user.
  • It's easy to use.

..the list goes on. It's simply a powerful messaging system that lives up to it's expectations and then some.

MARCH 13, 2016

Go: Good for systems & web programming

Go is a relatively new programming language. With design cues from the original creators of C, Go was designed to be a modern successor, with garbage collection, documentation system, and most importantly, concurrency. In a world with growing demands and the fall of Moore's law, concurrency is playing a huge part in the modern world of programming. As expected, Go has excellent systems programming capabilities, just as C does. But unlike C, Go also excels in the field of web programming, which C tends to have difficulties with when using standard library components. For example, a wiki like this one can be contained in a single file:

// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
 
package main
 
import (
	"html/template"
	"io/ioutil"
	"net/http"
	"regexp"
)
 
type Page struct {
	Title string
	Body  []byte
}
 
func (p *Page) save() error {
	filename := p.Title + ".txt"
	return ioutil.WriteFile(filename, p.Body, 0600)
}
 
func loadPage(title string) (*Page, error) {
	filename := title + ".txt"
	body, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}
	return &Page{Title: title, Body: body}, nil
}
 
func viewHandler(w http.ResponseWriter, r *http.Request, title string) {
	p, err := loadPage(title)
	if err != nil {
		http.Redirect(w, r, "/edit/"+title, http.StatusFound)
		return
	}
	renderTemplate(w, "view", p)
}
 
func editHandler(w http.ResponseWriter, r *http.Request, title string) {
	p, err := loadPage(title)
	if err != nil {
		p = &Page{Title: title}
	}
	renderTemplate(w, "edit", p)
}
 
func saveHandler(w http.ResponseWriter, r *http.Request, title string) {
	body := r.FormValue("body")
	p := &Page{Title: title, Body: []byte(body)}
	err := p.save()
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	http.Redirect(w, r, "/view/"+title, http.StatusFound)
}
 
var templates = template.Must(template.ParseFiles("edit.html", "view.html"))
 
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
	err := templates.ExecuteTemplate(w, tmpl+".html", p)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}
 
var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")
 
func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		m := validPath.FindStringSubmatch(r.URL.Path)
		if m == nil {
			http.NotFound(w, r)
			return
		}
		fn(w, r, m[2])
	}
}
 
func main() {
	http.HandleFunc("/view/", makeHandler(viewHandler))
	http.HandleFunc("/edit/", makeHandler(editHandler))
	http.HandleFunc("/save/", makeHandler(saveHandler))
 
	http.ListenAndServe(":8080", nil)
}

With efficiency like that, Go is able to handle HUGE amounts of traffic. Popular solutions such as PHP or Ruby on Rails tend to struggle more when it comes to traffic of that density. In summary, Go is a powerful, fast, and modern nod to C.

APRIL 4, 2016

Reddit's "Robin" chat system is an effective concept

Robin, a product of a reddit April Fool's Day joke, is incredibly popular. Users decide whether to stay, grow, or abandon the room, with those who abstain from voting automatically opting with abandon. When a majority choose to stay, the room becomes a subreddit containing all the users who participated in the room. When the majority choose to grow, the room will merge after a period of time with a room of similar size. These rooms can be huge, as I was in one with over 1000 users. The largest right now is 3000 users. But what is unique about this chat system is that it encourages unity between the choices of users and adding a competitive aspect to communication. Even though it's scheduled to end April 8, I am looking forward to a permanent solution. , a product of a reddit April Fool's Day joke, is incredibly popular. Users decide whether to stay, grow, or abandon the room, with those who abstain from voting automatically opting with abandon. When a majority choose to stay, the room becomes a subreddit containing all the users who participated in the room. When the majority choose to grow, the room will merge after a period of time with a room of similar size. These rooms can be huge, as I was in one with over 1000 users. The largest right now is 3000 users. But what is unique about this chat system is that it encourages unity between the choices of users and adding a competitive aspect to communication. Even though it's scheduled to end April 8, I am looking forward to a permanent solution.

APRIL 20, 2016

Ubuntu MATE: A GNOME legacy worth using

Ubuntu MATE is an excellent Ubuntu-based distribution for both the beginner and expert Linux user. “That's a bunch of nonsense!”, you might say - but hear me out, there's some decent points I have to make. I should start with the fact that even though MATE is considered “new”, the code itself is fairly mature, considering MATE is a progression of the GNOME 2 desktop environment. MATE “happened” because the changes that GNOME 3 brought to the table were considered to be an overall nuisance, with a troubling user interface, much higher resource demands, and a now required dependency on systemd, which by itself has created a lot of controversy and anger among the Linux community. MATE sticks to a traditional desktop design that many are familiar with and enjoy using. This causes less confusion with beginners and allows for more productivity among the experts as there is less resource demand (useless visual effects). Point said, MATE has a very mature/stable codebase and has a setup that is familiar to the beginner and friendly to the expert. Also of note is that MATE is very “tweakable”, having a reputation similar to that of XFCE and KDE. One can easily change the appearance and mechanics of their desktop environment, and allow for basic visual effects and panel plugins. This allows for countless setups that are tailored to the demands of the user. One could say MATE fills the void between KDE and XFCE - more lightweight than KDE but prettier and easier to use than XFCE. Continuing on, MATE is very portable without the systemd requirement and the lightweight footprint, allowing it to not only be used on Linux distributions but *BSD systems as well. This works well for those who enjoy a more “traditional” UNIX environment. Even though Ubuntu MATE does use systemd and Linux, it does provide Ubuntu's powerful fork of APT and all software associated with it, with thousands of software packages available with a couple keystrokes and maybe some mouse usage. Overall, Ubuntu MATE is worth a try.

blog/spring2016/dsaunde6/start.txt · Last modified: 2016/01/18 16:05 by 127.0.0.1