Skip to content

Instantly share code, notes, and snippets.

View datatypevoid's full-sized avatar

Null Void datatypevoid

View GitHub Profile
@datatypevoid
datatypevoid / README.md
Created July 8, 2018 12:30 — forked from bzamecnik/README.md
Anaconda Python script running as systemd service

Anaconda Python script running as systemd service

This way a Python daemon can be installed on Rasbian, Ubuntu or similar systems using systemd.

Installing:

sudo cp hello.service /lib/systemd/system/hello.service
sudo systemctl daemon-reload
sudo systemctl enable hello.service
@datatypevoid
datatypevoid / DESIGN.md
Created June 20, 2018 21:22 — forked from yosriady/DESIGN.md
OAuth2 Authentication Microservices Design

Auth

Disclaimer

Creating an OAuth2 server is not a task that should be taken lightly. There are many security loopholes that could be exploited, and regular examinations are critical to handle possible vulnerabilities.

Introduction

Auth is an authentication microservice based on the OAuth2 identity delegation protocol.

@datatypevoid
datatypevoid / README-Template.md
Created May 16, 2018 01:18 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@datatypevoid
datatypevoid / color-conversion-algorithms.js
Created February 2, 2018 03:41 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@datatypevoid
datatypevoid / jwtRS256.sh
Created January 28, 2018 21:53 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@datatypevoid
datatypevoid / client.js
Created November 6, 2017 17:03 — forked from PaulMougel/client.js
File upload in Node.js to an Express server, using streams
// node: v0.10.21
// request: 2.27.0
var request = require('request');
var fs = require('fs');
var r = request.post("http://server.com:3000/");
// See http://nodejs.org/api/stream.html#stream_new_stream_readable_options
// for more information about the highWaterMark
// Basically, this will make the stream emit smaller chunks of data (ie. more precise upload state)
var upload = fs.createReadStream('f.jpg', { highWaterMark: 500 });
@datatypevoid
datatypevoid / Dockerfile
Created October 31, 2017 17:17 — forked from remarkablemark/Dockerfile
Install node and npm with nvm using Docker.
# set the base image to Debian
# https://hub.docker.com/_/debian/
FROM debian:latest
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# update the repository sources list
# and install dependencies
RUN apt-get update \
@datatypevoid
datatypevoid / gh-deploy-clone.sh
Created October 11, 2017 13:01 — forked from blvz/gh-deploy-clone.sh
Creates a deploy key and clones the repository.
#!/usr/bin/env bash
read -r -d '' usage << EOM
Usage:
gh-deploy-clone user/repo [ENVIRONMENT]
EOM
[ -z "$1" ] && echo && echo "$usage" && echo && exit 1
@datatypevoid
datatypevoid / repo-rinse.sh
Created October 7, 2017 00:22 — forked from nicktoumpelis/repo-rinse.sh
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@datatypevoid
datatypevoid / gist:55dffe081e0080e8ddcf05199cd23f49
Created July 23, 2017 13:16 — forked from lingo/gist:5e53d2cb5b282d53d912
Separation of logic from request handlers
// mylogic.js
var MyLogic = {
_currentAccount: null,
fetchAccountByID: function(id) {
// fetch account from database, use promises to reject/resolve
},
setCurrentAccount: function(account) {
MyLogic._currentAccount = account;
}