Skip to content

Instantly share code, notes, and snippets.

View brydavis's full-sized avatar

Bryan Davis brydavis

View GitHub Profile
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@brydavis
brydavis / GDrive.py
Created January 28, 2018 08:37 — forked from rajarsheem/GDrive.py
Python terminal client for Google Drive for easy uploading, deleting, listing, sharing files or folders. (See usage in the comment)
from __future__ import print_function
import sys
import io
import pip
import httplib2
import os
from mimetypes import MimeTypes
@brydavis
brydavis / neo4j_cypher_cheatsheet.md
Created June 19, 2018 05:22 — forked from DaniSancas/neo4j_cypher_cheatsheet.md
Neo4j's Cypher queries cheatsheet

Neo4j Tutorial

Fundamentals

Store any kind of data using the following graph concepts:

  • Node: Graph data records
  • Relationship: Connect nodes (has direction and a type)
  • Property: Stores data in key-value pair in nodes and relationships
  • Label: Groups nodes and relationships (optional)
@brydavis
brydavis / serve.go
Created July 1, 2018 05:45 — forked from paulmach/serve.go
Simple Static File Server in 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
@brydavis
brydavis / sshclient.go
Created August 11, 2018 00:31 — forked from josephspurrier/sshclient.go
Golang SSH Client
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@brydavis
brydavis / ssh_client.go
Created August 16, 2018 22:09 — forked from iamralch/ssh_client.go
SSH client in GO
package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"strings"
@brydavis
brydavis / main.go
Created October 6, 2018 08:04 — forked from mpfund/main.go
golang upload file to aws
package main
import (
"compress/gzip"
"io"
"log"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
@brydavis
brydavis / OAuth.md
Created October 7, 2018 08:41 — forked from Integralist/OAuth.md
OAuth

OAuth is a mechanism that allows a user to authorize your application to access his/her data from another service without giving you their authentication details.

For a banking monitoring application (e.g. your application reads the user's banking data and displays it within some useful diagrams), the steps could look something like the following:

  1. User requests API action from your application (e.g. show me my spending graph)
  2. Your application requests access to your bank
  3. User's bank service tells the users your application would like access to it
  4. User accepts or declines the request to access your banking data
  5. The bank provides a temporary code to your application
  6. Your app requests a token while passing back the code it was given from the bank
@brydavis
brydavis / golang-tls.md
Created October 10, 2018 06:29 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@brydavis
brydavis / redirectExample.go
Created October 10, 2018 17:32 — forked from d-schmidt/redirectExample.go
How to redirect HTTP to HTTPS with a golang webserver.
package main
import (
"net/http"
"log"
)
func redirect(w http.ResponseWriter, req *http.Request) {
// remove/add not default ports from req.Host
target := "https://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {