Skip to content

Instantly share code, notes, and snippets.

🌱
Working remotely

Will Willems NickolasBoyer

🌱
Working remotely
Block or report user

Report or block NickolasBoyer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@NickolasBoyer
NickolasBoyer / download-zip.js
Created Aug 12, 2019
Get .zip file with Node, unzip it and save it to disk by piping the response body into unzipper
View download-zip.js
const unzipper = require('unzipper');
const fetch = require('node-fetch')
// get data
fetch('https://example.org/my-archive.zip')
.then(resp => {
return new Promise((res, rej) => {
resp.body
.pipe(unzipper.Extract({ path: '/tmp/my-archive' }))
.on('error', rej)
@NickolasBoyer
NickolasBoyer / AppCompass.vue
Created May 3, 2019
A compass indicator component for Vue.js
View AppCompass.vue
<template>
<div class="compass">
<!-- Arrow -->
<svg class="compass__arrow" :style="`transform: rotate(${degrees}deg);`" width="37px" height="36px" viewBox="0 0 37 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="spot-search-copy-10" transform="translate(-236.000000, -796.000000)">
<g id="Group" transform="translate(236.000000, 796.000000)">
<rect id="Rectangle" opacity="0" x="0.5" y="0" width="36" height="36"></rect>
<polygon id="Rectangle" fill="#FFFFFF" points="14 18 18.5 7 23 18 18.5292306 29"></polygon>
<polygon id="Rectangle" fill="#FF0000" transform="translate(18.500000, 12.500000) scale(1, -1) translate(-18.500000, -12.500000) " points="14 7 23 7 18.5292306 18"></polygon>
@NickolasBoyer
NickolasBoyer / upload.js
Created Jan 28, 2019
Upload email templates to Sparkpost
View upload.js
require('dotenv').config()
const fs = require('fs')
const path = require('path')
const SparkPost = require('sparkpost')
const templateFolder = './templates/html/'
const sparkpostApiKey = process.env.SPARKPOST_API_KEY
const client = new SparkPost(sparkpostApiKey)
@NickolasBoyer
NickolasBoyer / CompoundInterestCalculator.js
Last active Jul 2, 2018
Calculates total savings due to compund interest based on a yearly rate and a monthly deposit.
View CompoundInterestCalculator.js
// Calculates total savings as result of a monthly deposit.
// vars
var monthlySaving = 500; // monthly amount you deposit in your savings account/index fund
var initialSavings = 0; // initial capital you start with
var yearlyInterest = 1.05 // in this case %5
var years = 15; // amount of years to calculate for
var goal = 0 // financial goal, can leave at 0
// computed
@NickolasBoyer
NickolasBoyer / wildcard_SSL_dns_callange.md
Created Apr 9, 2018
Switch to wildcard SSL cert with certbot
View wildcard_SSL_dns_callange.md

If you want to switch from using a regulair certificate/certificates to using Let's Encrypt's new wildcard cert there are some things you still neeed to do, here is a simple command that should suffice:

sudo certbot certonly --cert-name YOURCERTNAME.com -d *.DOMAIN.com,DOMAIN.com --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges=dns

Certbot will walk you trough the verfication using DNS which currently is the only option with wildcard support, you'll need to add two TXT record for verification.

Good luck!

@NickolasBoyer
NickolasBoyer / scraper.py
Last active Feb 18, 2017
Simple Python 3.5.2 Marktplaats scraping example with Beautiful Soup 4
View scraper.py
import requests
import urllib.parse
import numpy as np
import matplotlib.pyplot as plt
from bs4 import BeautifulSoup
def crawlmp( base_url, parameters, add_to_url = '' ):
""" Parameters dictionairy can contain:
query[str],
categoryId[int],
You can’t perform that action at this time.