Skip to content

Instantly share code, notes, and snippets.

View tolu's full-sized avatar

Tobias Lundin tolu

  • Elate
  • Oslo, Norway
View GitHub Profile
@tolu
tolu / Dockerfile
Created November 14, 2022 21:21
Docker nginx static web server
FROM node:lts-alpine as BUILD
WORKDIR /app
# Copy files needed for install
COPY .npmrc ./
COPY *.json ./
# Install deps
RUN npm ci --ignore-scripts
@tolu
tolu / express-puppeteer-server.ts
Created February 18, 2021 22:03
SPA meta-tag renderer (for fb bots etc)
import express from 'express';
import puppeteer from 'puppeteer';
import ua from 'useragent';
const isBot = (agent: ua.Details) => {
return !agent.webkit && !agent.opera && !agent.ie &&
!agent.chrome && !agent.safari && !agent.mobile_safari &&
!agent.firefox && !agent.mozilla && !agent.android;
}
@tolu
tolu / wsl-puppeteer.js
Last active January 28, 2022 14:20
Puppeteer on WSL
// resource: http://ktkr3d.github.io/2020/01/27/Puppeteer-on-WSL/
// install puppeteer
// > npm i -g puppeteer
// use chrome from windows: add this to ~/.profile
// PATH=/mnt/c/Program\ Files\ \(x86\)/Google/Chrome/Application:$PATH
const puppeteer = require('puppeteer');
@tolu
tolu / readme.md
Last active August 23, 2018 08:12
Setup Mac

New Mac Setup

  1. install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew update
brew doctor
@tolu
tolu / google_drive_hosting.md
Last active June 13, 2017 11:51
Host images on Google Drive

Google Drive hosting

Use the Get Link option in Google Drive to get the URL.
Use <img src=""> tag in HTML (or the link syntax ![alt text](image-url)) and paste the link in there.
Change Open? in the URL to uc?.

Bug
![BUG][bug]

@tolu
tolu / 0.ES6-issues.md
Created August 15, 2016 09:56
ES6 pitfalls and potential danger zones with babel & webpack

ES6 issues

Just a bunch of examples of errors that are potentially hard to find and that eslint does not break on

  1. Temporal dead zones
  2. Cyclic dependencies
@tolu
tolu / A-ES6-examples-readme.md
Last active September 10, 2018 08:32
Modern javascript examples with old counterparts
#BoxStarterConfigFile
#Basic Setup
Update-ExecutionPolicy Unrestricted
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
#Windows Features
cinst Microsoft-Hyper-V-All -source windowsfeatures
cinst IIS-WebServerRole -source windowsfeatures
cinst IIS-HttpCompressionDynamic -source windowsfeatures
@tolu
tolu / ffmpeg.md
Last active December 6, 2016 01:20
ffmpeg Usage

ffmpeg HowTo

Ripping

DVD

From ripping-dvd-with-ffmpeg

ffmpeg -i concat:VTS_01_1.VOB\|VTS_01_2.VOB\|VTS_01_3.VOB -map 0:v -map 0:a -c:v libx264 -crf 18 -vf yadif -c:a flac aikido.mkv
@tolu
tolu / TeamCityNode.cmd
Last active May 20, 2016 23:44
TeamCity helper for Node-based commands (grunt, gulp for now)
:: https://gist.github.com/tolu/d867c4ef9581251b46dc
@echo off
:: Expects to be called with [command] [params*]
:: Where command is either "grunt" or "gulp"
:: File executes command and prints TeamCity separators
:: 1. Makes sure that global version of command is installed
:: 2. Calls npm install in current directory
:: 3. Calls command with provided [params]
:: 4. Prints time of execution