Skip to content

Instantly share code, notes, and snippets.

David Pennington Xeoncross

Block or report user

Report or block Xeoncross

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Xeoncross
Xeoncross / ssr_test.go
Created Jun 1, 2019
Example of using chromedp to prerender a create-react-app frontend using fake SSR via chrome headless
View ssr_test.go
package main
import (
"context"
"io/ioutil"
"log"
"strings"
"testing"
"github.com/chromedp/cdproto/dom"
@Xeoncross
Xeoncross / google_pixel_2_camera-getParameters.md
Last active May 22, 2019
Parameters provided by the camera API on android for a Google Pixel 2
View google_pixel_2_camera-getParameters.md
@Xeoncross
Xeoncross / validation_middleware.go
Last active May 17, 2019
Simple validation middleware following after the idea of gongular but without doing things at the handler level.
View validation_middleware.go
package validation_middleware
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"net/http/httptest"
"reflect"
@Xeoncross
Xeoncross / README.md
Last active Apr 24, 2019
VSCode settings to get VSCode Solarized Light to match Atom Solarized Light
View README.md
@Xeoncross
Xeoncross / read_only_mysql_user.sh
Last active Apr 22, 2019
Simple SSH user for read-only access to MySQL. Note, they still have a home directory and full SSH access so this assumes you trust them and/or need them to have access to other system features.
View read_only_mysql_user.sh
# Create the SSH/system user
useradd dbreports
mkdir -p /home/dbreports/.ssh
chown -R dbreports:dbreports /home/dbreports/
chmod 700 /home/dbreports/.ssh
# Add the SSH keys
vim /home/dbreports/.ssh/authorized_keys
chmod 644 .ssh/authorized_keys
@Xeoncross
Xeoncross / simple_query.go
Created Apr 17, 2019
Simple helper function to reduce duplicated `rows.Scan()` code
View simple_query.go
package main
import (
"fmt"
"log"
"reflect"
"testing"
)
// What if you could provide the query, params, and the slice of objects to populate?
@Xeoncross
Xeoncross / dump.go
Created Apr 17, 2019 — forked from janhalfar/dump.go
golang reflection games
View dump.go
func dump(v reflect.Value, path string) {
switch v.Type().Kind() {
case reflect.Interface:
if v.Elem().Type().Kind() == reflect.Interface {
fmt.Println(path, ":", "merry xmas an interface")
} else {
dump(v.Elem(), path)
}
case reflect.Int, reflect.Int64, reflect.Float64:
fmt.Println(path, ":", "it is a number", v.String())
View hi_reddit.go
package main
import (
"fmt"
"reflect"
)
//function types
type mapf func(interface{}) interface{}
@Xeoncross
Xeoncross / serve.go
Created Apr 14, 2019 — forked from paulmach/serve.go
Simple Static File Server in Go
View serve.go
/*
Serve is a very simple static file server in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
package main
@Xeoncross
Xeoncross / keybase.md
Created Apr 9, 2019
New Keybase Identity
View keybase.md

Keybase proof

I hereby claim:

  • I am xeoncross on github.
  • I am xeoncross (https://keybase.io/xeoncross) on keybase.
  • I have a public key ASDJo_-IuEPErcIf46_LTrZ3apNvcRQOPOjqEFnOdixU6wo

To claim this, I am signing this object:

You can’t perform that action at this time.