Skip to content

Instantly share code, notes, and snippets.

View nanoninja's full-sized avatar

Vincent Letourneau nanoninja

View GitHub Profile
@nanoninja
nanoninja / jose_jwt_go_usage.md
Created September 29, 2016 14:35
JOSE - JWT Usage Examples

JOSE - JWT Usage Examples

JOSE is a comprehensive set of JWT, JWS, and JWE libraries.

jwt.io

Installation

go get github.com/SermoDigital/jose
@nanoninja
nanoninja / RegexRouter.php
Last active May 28, 2022 16:41
Simple Regex Router
class RegexRouter
{
private $routes = array();
public function addRoute($route, callable $service)
{
$route = '#^'.$route.'$#';
$this->routes[$route] = $service;
return $this;
}
server {
listen 80;
server_name localhost;
root /var/www/html;
error_log /var/log/nginx/localhost.error.log;
access_log /var/log/nginx/localhost.access.log;
location / {
@nanoninja
nanoninja / ubuntu.sh
Created January 21, 2019 09:00
ubuntu1804
#!/bin/bash
USERNAME=$USER
#-----------------
# Remove packages
#-----------------
sudo apt purge --assume-yes aisleriot \
gnome-sudoku \
ace-of-penguins \
@nanoninja
nanoninja / README.md
Last active September 7, 2018 14:22
MongoDB Service Installation
@nanoninja
nanoninja / README.md
Last active September 16, 2017 13:51
Websocket Go Chat

Websocket Go chat

Installation

After installing Go and setting up your GOPATH

go get golang.org/x/net/websocket

Running chat

@nanoninja
nanoninja / time_display.go
Last active July 22, 2017 14:48
Go Time Display Using Ticker
package main
import (
"fmt"
"time"
)
func main() {
TimeDisplay(true)
}
@nanoninja
nanoninja / README.md
Last active July 22, 2017 13:28
Concurrent Stack Of Errors

Concurrent Stack Of Errors

It just an experimental package to handle concurrent errors stack. The concept is based on the First Class Functions and inspired by Dave Cheney posts.

Example

func main() {
 s := NewStack()
@nanoninja
nanoninja / go-memento.md
Last active July 21, 2017 15:00
Go Memento

Go Memento

Code Coverage

Download

go get golang.org/x/tools/cmd/cover
@nanoninja
nanoninja / http_basic_auth_timeout.go
Created July 11, 2017 21:58
Go Basic Authentication with timeout
package main
import (
"fmt"
"net/http"
"time"
)
var Realm = "Authorization Required"