Skip to content

Instantly share code, notes, and snippets.

View tsilvers's full-sized avatar

Tom Silverstein tsilvers

  • Resequence, LLC
View GitHub Profile
@tsilvers
tsilvers / upload.go
Last active January 23, 2024 15:27
Upload files to a Go server using web sockets.
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"time"
@tsilvers
tsilvers / websocketgames.go
Last active July 8, 2023 16:08
Golang code to send binary image data to client through a websocket connection.
package main
import (
"flag"
"fmt"
"html/template"
"log"
"net/http"
"time"
@tsilvers
tsilvers / nestedStructs.go
Created March 1, 2018 03:55
Golang walk through nested structures with formatted, indented output
package main
import (
"fmt"
"reflect"
"strings"
)
type S1 struct {
A1 int
@tsilvers
tsilvers / macUint64.go
Created August 25, 2017 19:39
Golang code to get MAC address for purposes of generating a unique id. Returns a uint64. Skips virtual MAC addresses (Locally Administered Addresses).
package main
import (
"bytes"
"fmt"
"net"
)
func main() {
fmt.Printf("MAC: %16.16X\n", macUint64())
@tsilvers
tsilvers / setup.txt
Last active June 1, 2016 20:34
Setup instructions for Javascript testing with Behat / Mink
=== SETUP ===
Instructions were tested with Ubuntu, but should be similar for other Linux distros.
Java is needed to run the Selenium Stabdalone Server:
sudo apt-get install default-jre
Add Selenium Standalone Server via Composer:
composer require --dev se/selenium-server-standalone
Add Mink Selenium2 driver via Composer: