This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:lts-alpine as BUILD | |
WORKDIR /app | |
# Copy files needed for install | |
COPY .npmrc ./ | |
COPY *.json ./ | |
# Install deps | |
RUN npm ci --ignore-scripts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Function to get the cutoff date | |
get_cutoff_date() { | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
# macOS | |
date -v-12m +%s | |
else | |
# Linux and others | |
date -d "12 months ago" +%s |
OlderNewer