Procházet zdrojové kódy

Various tweaks

Noah Petherbridge před 3 roky
7 změnil soubory, kde provedl 85 přidání a 53 odebrání
  1. +3
  2. +3
  3. +2
  4. +1
  5. +1
  6. +73
  7. +2

+ 3
- 3
www/.layout.gohtml Zobrazit soubor

@@ -38,8 +38,8 @@

<div class="row">

<div class="col-10 order-12">
<div class="k-content-panel">
<div class="order-1 order-md-12 col-12 col-md-10">
<div class="k-content-panel mb-4">
{{ if .SetupNeeded }}
<div class="alert alert-success">
Your web blog needs to be set up!
@@ -76,7 +76,7 @@

<div class="col-sm-2 order-1">
<div class="order-12 order-md-1 col-12 col-md-2">
<div class="k-navpanel" id="navbar">
<div class="k-section">Kirsle</div>

+ 3
- 11
www/about.gohtml Zobrazit soubor

@@ -4,24 +4,16 @@
<h1>About Me</h1>

<div class="row">
<div class="col-lg-2">
<div class="col-2 markdown">
<img src="/static/photos/ff7ec4f5.jpg" class="img-responsive portrait" alt="Kirsle"><p>

<img src="/static/icons/aim.gif" width="16" height="15" alt="AIM">
<a href="aim:goim?ScreenName=Kirsle">Kirsle</a><br>

<img src="/static/icons/xmpp.gif" width="16" height="16" alt="XMPP">

&#0164; <a href="/contact">Send me an e-mail</a>

<div class="col-lg-10">
<div class="col-10">
<h2>Hello world!</h2>

My name is <strong>Noah</strong> and this is my website. I am a 29-year-old software
My name is <strong>Noah</strong> and this is my website. I am a 30-year-old software
engineer who lives in Los Angeles. My areas of expertise are primarily in Perl and
Python back-end software development, however I believe I have a knack for the front
end as well.<p>

+ 2
- 32
www/contact/index.gohtml Zobrazit soubor

@@ -3,38 +3,8 @@

<h1>Contact Me</h1>

You can use the form below to send me an e-mail. Alternatively you can contact
me on an instant messenger
(<a href="">Off-the-Record</a> optional):<p>

<table class="table" style="width: auto" border="0" cellspacing="4" cellpadding="4">
<img src="/static/icons/aim.gif" width="16" height="15" alt="AIM">
<a href="aim:goim?ScreenName=Kirsle">Kirsle</a>
<img src="/static/icons/xmpp.gif" width="16" height="16" alt="XMPP">

Things that you <strong>SHOULD NOT</strong> use this form for:
You can use the form below to send me an e-mail. Things that you
<strong>SHOULD NOT</strong> use this form for:

<li>Any SEO business solicitations.</li>

+ 1
- 4
www/raspberrypi.gohtml Zobrazit soubor

@@ -77,9 +77,6 @@ the <code>audio</code> group.
You'll need to do this <em>before</em> starting the VNC server. If you've already
started one, shut it down and restart it.

{{ include_page("comment.partial_index",
subject="Raspberry Pi",
) | safe }}
{{ RenderComments "Raspberry Pi" "raspberrypi" }}

{{ end }}

+ 1
- 1
www/rendering.gohtml Zobrazit soubor

@@ -6,7 +6,7 @@
This page contains some of my better 3D renderings. Most of these images were
modeled more or less in AutoCAD 2006 and rendered in 3DS Max 8.<p>

<table border="0" cellspacing="10" cellpadding="0">
<table border="0" cellspacing="10" cellpadding="10">
<td align="center" valign="top">
<a href="/creativity/rendered/kawar.jpg">

+ 73
- 0
www/wiki/ Zobrazit soubor

@@ -0,0 +1,73 @@
# Future Project Ideas

## Hybrid WebSocket/TCP Socket Library (Go)


This would be a Go library for writing custom TCP services, like Go [net](, but which also transparently handles WebSocket HTTP requests. This way your custom protocol can be used easily by custom clients as well as by WebSocket clients.

It would only require that your protocol waits for the client to speak first after connecting. This way, if the first line by the client is an HTTP request, the TCP server can parse the rest of the headers and send back an HTTP response, either to upgrade the connection to a WebSocket or to give a static HTML response (like an error page).

Out-of-box the HTTP support would send *all* WebSocket requests (regardless of URI) to the TCP server and all other HTTP requests to a static error page. Customization options would include replacing the static error page with a custom one, inserting a standard HTTP multiplexer (router) for more custom routes, or requiring the WebSocket request be at a specific URI.

## Stream Slicer (Go)


This would be a Go library that can accept a stream object (for example, a file handle) that implements `io.ReadSeeker` and returns a "slice" of that stream, with a limited range.

An example use case could be implementing a file archiving algorithm, where the data for an individual file is at a certain offset of the archive and has a certain length. You could get a "slice" of the archive for _just_ that file, and `.Read()` it until EOF, without worrying about the implementation details.

API example:

// Get a filehandle stream
fh, _ := os.Open("/path/to/file.bin")

// Slice out a part of it from 512 bytes in and
// a length of 1024 bytes.
slice := streamslice.New(fh, 512, 1024)

result := make([]byte, 1024)

Implementation notes:

// The struct + method surface could be like...
type StreamSlice struct {
source io.ReadSeeker // the larger / original filehandle
start int // offset from `source` to be treated as position zero
index int // current position in the 'slice' starting from zero
stop int // the `start` + the offset to limit the slice

// StreamSlice also implements io.ReadSeeker
Read(p []byte) (n int, err error)
Seek(offset int64, whence int) (int64, error)

func New(fh io.ReadSeeker, offset int64, length int64) *StreamSlice {
return &StreamSlice{
source: fh,
start: offset,
index: 0,
stop: offset + length,

func (s *StreamSlice) Read(p []byte) (n int, err error) {
// something along the lines of... seek to the current index,
// read until we reach `stop` or run out of space in `p`,
// whichever comes first. TBD.
s.source.Seek(s.offset + s.index, io.SeekStart)
// ...

The struct would keep private references to the original stream, the absolute position of said stream where your slice begins, the _relative_ position of the slice itself, and the length. When calling `Read()`, it would `index++` until it reaches the `stop` and then return EOF.

When the user calls `Seek(0, io.SeekStart)` to rewind the slice, calling `Read()` would again return bytes starting from the beginning of the slice.

This could be a fun demonstration of working with Go's type system to create a useful interface for *any* kind of `io.ReadSeeker`, not just file-like objects.

+ 2
- 2
www/wiki/ Zobrazit soubor

@@ -60,8 +60,8 @@ $ rpmbuild -ba python-rivescript.spec
1. Build distributable files: `grunt dist`
2. Remove cruft: `rm -rf node_modules`
3. Go up a directory to create zip/tar files
* zip -r rivescript-js -x '*.git*'
* tar -czvf rivescript-js-1.1.2.tar.gz rivescript-js --exclude .git
* `zip -r rivescript-js -x '*.git*'`
* `tar -czvf rivescript-js-1.1.2.tar.gz rivescript-js --exclude .git`

See also: [npm developers](

Načítá se…