Skip to content

Instantly share code, notes, and snippets.

@l-wagner
l-wagner / nginx.conf
Last active January 22, 2021 13:10
nginx config example for Node, React, Vue & Python apps. #nginx
// ============== NGINX CONFIG FILE =================
# for several node or uwsgi apps hosted in sub locations
# Forward all HTTP requests to HTTPS
server {
listen 80
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
server {
@l-wagner
l-wagner / ecosystem.config.js
Created January 22, 2021 13:04
PM2 Ecosystem config example
// ============== PM2 ECOSYSTEM FILE =================
// /srv/www/pm2/ecosystem.config.js
// shared environment variables
const commonEnv = {
devEnv: {},
prodEnv: {
SHARED_SECRET: '123456',
ANOTHER_SHARED_SECRET: '123456',
NODE_ENV: 'PROD',
@l-wagner
l-wagner / GoodreadsParser.py
Last active October 24, 2020 19:03
Pulling your read books from Goodreads and translate them from XML to JSON. If you read more than 200 books, it sends requests in batches with a 2s sleep between each get.
import json
import time
import math
import sys
import xmltodict
import requests
from datetime import date
with open("config.json") as f:
config = json.load(f)
@l-wagner
l-wagner / HandsontableCustomRenderer.js
Created October 24, 2020 17:18
Custom Renderer for values <1. This took me a minute, as applying the renderer overwrites all other editor settings.
import React, { useState, useEffect } from 'react';
import { getInventory } from './services/services';
import { makeStyles } from '@material-ui/core';
import { HotTable } from '@handsontable/react';
import Handsontable from 'handsontable';
import 'handsontable/dist/handsontable.full.css';
const useStyles = makeStyles((theme) => ({
container: {
@l-wagner
l-wagner / DynamicDropdownExcel.js
Created October 24, 2020 16:10
Using ExcelJs to create sheet with dynamic dropdown options
import FileSaver from 'file-saver';
import Excel from 'exceljs';
/* Export excel file with dynamic dropdowns
All hope abandon, ye who enter here.
Data argument looks like
{
columns: [ { col1Def }, { col2Def } ],
rows: [ { columnDataField: value, columnDataField: value } ]
fileName: 'Name'