Skip to content

Instantly share code, notes, and snippets.

View datatypevoid's full-sized avatar

Null Void datatypevoid

View GitHub Profile
@datatypevoid
datatypevoid / gist:9702139044466b321a2547aced9631ea
Created August 10, 2018 00:34 — forked from pguillory/gist:729616
Hooking into Node.js stdout
var util = require('util')
function hook_stdout(callback) {
var old_write = process.stdout.write
process.stdout.write = (function(write) {
return function(string, encoding, fd) {
write.apply(process.stdout, arguments)
callback(string, encoding, fd)
}
Internal Server Error
java.lang.NoSuchMethodError: gitbucket.core.service.SystemSettingsService$SystemSettings.ssh()Z
gitbucket.gist.html.menu$.apply(menu.template.scala:56)
gitbucket.gist.html.detail$.apply(detail.template.scala:33)
gitbucket.gist.controller.GistControllerBase._gistDetail(GistController.scala:483)
gitbucket.gist.controller.GistControllerBase._gist(GistController.scala:458)
gitbucket.gist.controller.GistControllerBase.$anonfun$$init$$3(GistController.scala:68)
org.scalatra.ScalatraBase.liftAction(ScalatraBase.scala:280)
org.scalatra.ScalatraBase.$anonfun$invoke$1(ScalatraBase.scala:274)
org.scalatra.ApiFormats.withRouteMultiParams(ApiFormats.scala:178)
@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 / baseError.ts
Created May 16, 2018 15:44
Generic TypeScript Error class
/*
* Imports
*/
/*
* Structures
*/
abstract class BaseError<T> extends Error {
@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 \