Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am kmaschta on github.
  • I am kmaschta (https://keybase.io/kmaschta) on keybase.
  • I have a public key ASCZaN5SJpgXVcd7XuqosiSCH_kN_xMilDHnwFZ4isGu6wo

To claim this, I am signing this object:

View Parse-International-Days.js
// https://www.journee-mondiale.com/les-journees-mondiales.htm
(() => {
const links = {};
const articles = document.querySelectorAll('article');
articles.forEach((article, monthIndex) => {
const items = article.querySelectorAll('li');
items.forEach((li) => {
@Kmaschta
Kmaschta / generate-self-signed-certificate-with-custom-CA.md
Created Jan 9, 2019
How to generate a self-signed that is valid for your browser (by creating your custom certificate authority)
View generate-self-signed-certificate-with-custom-CA.md

If you're using self-signed certificate for your web server on development, you might know the browser warning saying that your certificate isn't valid. If like me you had manually added an exception for this certificate error each time it showed up, this gist is for you.

Properly Configure OpenSSL with your DNS aliases

You'll have to create a self-signed certificate with a custom SubjectAltName.

  1. Find your openssl config. find /usr/lib -name openssl.cnf
View gist:bf07f6544b12806ae3b0dde2e571c5e7
### Keybase proof
I hereby claim:
* I am kmaschta on github.
* I am kmaschta (https://keybase.io/kmaschta) on keybase.
* I have a public key ASAvkWIvIk1a3VcepH9b0Rl9_wd2ECc7UaHwaUDbLtBuIwo
To claim this, I am signing this object:
@Kmaschta
Kmaschta / index.js
Created Mar 6, 2018
Apollo Memory Debug
View index.js
require('isomorphic-fetch');
const express = require('express');
const { makeExecutableSchema } = require('graphql-tools');
const graphqlHTTP = require('express-graphql');
const books = [
{ title: "Harry Potter and the Sorcerer's stone", author: "J.K. Rowling" },
{ title: "Jurassic Park", author: "Michael Crichton" },
];
@Kmaschta
Kmaschta / index.js
Created Feb 12, 2018
Express-Winston Benchmark
View index.js
const express = require('express');
const winston = require('winston');
const expressWinston = require('./express-winston');
const app = express();
const consoleFormatter = ({ level, meta: { req, res, responseTime, stack } }) => {
let msg = `${winston.config.colorize(level, level)} HTTP ${req.method} ${req.url}`;
if (res) {
@Kmaschta
Kmaschta / Makefile
Created Dec 12, 2017
Artifact deployment example
View Makefile
.PHONY: build
TAG ?=
SERVER ?= staging-server
install:
npm install
start:
node --require reify server.js
@Kmaschta
Kmaschta / setup-tests.js
Created Oct 27, 2017
Prevent unhandled Promise rejection errors
View setup-tests.js
// Warn from unhandled promise rejection that can occurs without failing tests
// jest --setupFiles setup-tests.js
process.on('unhandledRejection', (error, promise) => {
console.error('Unhandled Rejection at:', promise, `\n${error.stack}`);
});
@Kmaschta
Kmaschta / wakatime_stats.py
Created May 5, 2017
Retrieve a maximum of Wakatime stat
View wakatime_stats.py
#!/usr/bin/python
help = """Retrieve all the stats from WakaTime API
Usage:
wakatime_stats.py <token>
Options:
-h --help Show this very help message
See https://wakatime.com/developers
@Kmaschta
Kmaschta / install-gominer.sh
Last active Mar 22, 2017 — forked from albertstartup/steps.sh
AWS GPU / P2, Ubuntu 16.04, Nvidia driver 375 & CUDA 8.0, decred/gominer
View install-gominer.sh
#!/bin/bash
# Requirements
# - NVIDIA Driver - NVIDIA-Linux-x86_64-375.39.run - http://www.nvidia.fr/Download/index.aspx
# - CUDA runfile (local) - cuda_8.0.61_375.26_linux.run - https://developer.nvidia.com/cuda-downloads
sudo apt update -y && sudo apt upgrade -y
sudo apt install build-essential linux-image-extra-`uname -r` -y
chmod +x NVIDIA-Linux-x86_64-375.39.run