Skip to content

Instantly share code, notes, and snippets.

View thelimeburner's full-sized avatar

Lucas Chaufournier thelimeburner

View GitHub Profile
@thelimeburner
thelimeburner / auth.go
Created March 19, 2020 14:37
Basic Http auth for golang
//BasicAuth provides authentication for calling the manual operation Sourced from here: https://stackoverflow.com/a/39591234
func BasicAuth(handler http.HandlerFunc, username, password, realm string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
user, pass, ok := r.BasicAuth()
if !ok || subtle.ConstantTimeCompare([]byte(user), []byte(username)) != 1 || subtle.ConstantTimeCompare([]byte(pass), []byte(password)) != 1 {
w.Header().Set("WWW-Authenticate", `Basic realm="`+realm+`"`)
w.WriteHeader(401)
@thelimeburner
thelimeburner / test.go
Created February 4, 2020 03:46
Sample Goroutines
func helloWorld(){
fmt.Println("Hello World!")
}
func main(){
go helloWorld()
app: Sample Card App 1 # Name of the application, spaces are converted to _ for directory names
app_info:
deployment: single # Used by swarm to deploy the application: global | single | nodeName
language: golang # Language the card is written in. Currently supports: golang,node, manual
type: app # Denotes whether a system service, card : app | card_enabled_app
version: 1
vh:
- v0.6
apt -y update && apt install -y build-essential git vim.tiny wget curl sudo python3 python3-setuptools
cp /usr/bin/vim.tiny /usr/bin/vim
mkdir /source
cd /source
git clone https://github.com/movidius/ncsdk.git
wget https://bootstrap.pypa.io/get-pip.py
#!/bin/bash
#docker build -t rpi_streamer_v0.5:0.1 .
if [ "$#" -lt 2 ]; then
echo "Usage"
echo "$0 build | run version_number "
exit
fi
@thelimeburner
thelimeburner / Dockerfile.tensorflow
Created July 17, 2018 18:18
Trying to install tensorflow on docker
FROM arm64v8/ubuntu:16.04
#FROM thelimeburner/debian_base_arm64v8
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
build-essential \
libopenblas-dev \
wget \
git \
automake \
cmake \
@thelimeburner
thelimeburner / deploy_arm_packet.sh
Last active July 17, 2018 15:58
Used for new arm64 servers
#!/bin/bash
## General Pre-reqs
apt-get update -y
apt-get install -y vim build-essential tmux wget git
# Install Docker (source: https://help.packet.net/hardware/arm/docker-on-arm)
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@thelimeburner
thelimeburner / ufw.md
Created January 31, 2018 15:58 — forked from kimus/ufw.md
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@thelimeburner
thelimeburner / bigtext_printer.py
Created December 7, 2017 16:59
Prints big text fed to the command line
#!/usr/bin/python
import sys
number = sys.argv[1]
#print number
number_text = []
@thelimeburner
thelimeburner / bigtext_printer.py
Created December 7, 2017 16:59
Prints big text fed to the command line
#!/usr/bin/python
import sys
number = sys.argv[1]
#print number
number_text = []