npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mayohr-auto-punch

v1.2.2

Published

Automatic punch in/out system for mayohr

Readme

mayohr-auto-punch

Automatic punch in/out system for mayohr

Requirements

  • Node.js 20+

Usage

Create a .env file

Create a .env file with your credentials:

# Download the .env.example file:
mkdir -p ~/.mayohr-auto-punch \
  && wget -O ~/.mayohr-auto-punch/.env \
  https://raw.githubusercontent.com/awesome-oa-tools/mayohr-auto-punch/main/.env.example

# Update the .env file with your credentials:
vi ~/.mayohr-auto-punch/.env

Install puppeteer-chrome browser

npx puppeteer browsers install chrome

Run the script

There are two ways to run the script:

Option 1: Run from npm package

npx --yes --quite mayohr-auto-punch@latest

Option 2: Clone and run locally

git clone https://github.com/awesome-oa-tools/mayohr-auto-punch.git
cd mayohr-auto-punch
npm install
npm run dev

Run the script with Crontab

# Download the crontab config
mkdir -p ~/.mayohr-auto-punch/crontab && \
  wget -O ~/.mayohr-auto-punch/crontab/mayohr-auto-punch.sh \
    https://raw.githubusercontent.com/awesome-oa-tools/mayohr-auto-punch/main/examples/crontab/mayohr-auto-punch.sh && \
  chmod +x ~/.mayohr-auto-punch/crontab/mayohr-auto-punch.sh && \
  wget -O ~/.mayohr-auto-punch/crontab/mayohr \
    https://raw.githubusercontent.com/awesome-oa-tools/mayohr-auto-punch/main/examples/crontab/mayohr

# Add to existing crontab (this will merge with your existing crontab entries)
crontab -l | cat - ~/.mayohr-auto-punch/crontab/mayohr | crontab -

# Verify the crontab settings
crontab -l

# To remove crontab, run crontab -e

Run the script with Docker

docker run --rm -it \
  -v $HOME/.mayohr-auto-punch:/home/pptruser/.mayohr-auto-punch \
  justintw/mayohr-auto-punch:latest

Run the script with AWS Lambda

請使用 AWS 台北 ap-east-2 區域,否則登入公司帳號的 IP 來自外國,會被 IT 關切

# Download the .env.example file:
mkdir -p ~/.mayohr-auto-punch \
  && wget -O ~/.mayohr-auto-punch/.env \
  https://raw.githubusercontent.com/awesome-oa-tools/mayohr-auto-punch/main/.env.example

# Update the .env file with your credentials:
vi ~/.mayohr-auto-punch/.env
source ~/.mayohr-auto-punch/.env

# Download the AWS template
mkdir -p ~/.mayohr-auto-punch/aws \
  && wget -O ~/.mayohr-auto-punch/aws/ecr-template.yaml \
  https://raw.githubusercontent.com/awesome-oa-tools/mayohr-auto-punch/main/examples/aws/ecr-template.yaml \
  && wget -O ~/.mayohr-auto-punch/aws/lambda-template.yaml \
  https://raw.githubusercontent.com/awesome-oa-tools/mayohr-auto-punch/main/examples/aws/lambda-template.yaml

# Create SSM parameters for sensitive data
aws ssm put-parameter \
  --no-cli-pager \
  --region ap-east-2 \
  --name "/mayohr-auto-punch/ms-password" \
  --value "${MS_PASSWORD}" \
  --type "SecureString" \
  --overwrite

aws ssm put-parameter \
  --no-cli-pager \
  --region ap-east-2 \
  --name "/mayohr-auto-punch/ms-totp-secret" \
  --value "${MS_TOPT_SECRET}" \
  --type "SecureString" \
  --overwrite

aws ssm put-parameter \
  --no-cli-pager \
  --region ap-east-2 \
  --name "/mayohr-auto-punch/telegram-bot-token" \
  --value "${TELEGRAM_BOT_TOKEN}" \
  --type "SecureString" \
  --overwrite

# Create the ecr stack
aws cloudformation create-stack \
  --no-cli-pager \
  --region ap-east-2 \
  --stack-name mayohr-auto-punch-ecr \
  --template-body file://~/.mayohr-auto-punch/aws/ecr-template.yaml

# Get ECR URI
ECR_URI=$(aws cloudformation describe-stacks \
  --no-cli-pager \
  --region ap-east-2 \
  --stack-name mayohr-auto-punch-ecr \
  --query "Stacks[0].Outputs[?OutputKey=='RepositoryUri'].OutputValue" \
  --output text)

# Login to ECR
aws ecr get-login-password \
  --no-cli-pager \
  --region ap-east-2 \
  | docker login \
    --username AWS \
    --password-stdin \
    ${ECR_URI}

# Push the image to ECR
docker pull --platform linux/amd64 justintw/mayohr-auto-punch:latest \
  && docker tag justintw/mayohr-auto-punch:latest ${ECR_URI}:latest \
  && docker push ${ECR_URI}:latest

# Create the stack
aws cloudformation create-stack \
  --no-cli-pager \
  --region ap-east-2 \
  --stack-name mayohr-auto-punch-lambda \
  --template-body file://~/.mayohr-auto-punch/aws/lambda-template.yaml \
  --parameters \
    ParameterKey=ImageUri,ParameterValue=${ECR_URI}:latest \
    ParameterKey=MsDomain,ParameterValue=${MS_DOMAIN} \
    ParameterKey=MsUsername,ParameterValue=${MS_USERNAME} \
    ParameterKey=TelegramEnabled,ParameterValue=${TELEGRAM_ENABLED} \
    ParameterKey=TelegramChatId,ParameterValue=${TELEGRAM_CHAT_ID} \
  --capabilities CAPABILITY_IAM

# Trigger the function
aws lambda invoke \
  --no-cli-pager \
  --region ap-east-2 \
  --function-name mayohr-auto-punch \
  --invocation-type RequestResponse \
  --payload '{}' \
  output.json

# Check log
aws logs describe-log-streams \
  --no-cli-pager \
  --region ap-east-2 \
  --log-group-name /aws/lambda/mayohr-auto-punch \
  --order-by LastEventTime \
  --descending \
  --limit 1 \
  | jq -r '.logStreams[0].logStreamName' \
  | xargs -I {} aws logs get-log-events \
    --no-cli-pager \
    --region ap-east-2 \
    --log-group-name /aws/lambda/mayohr-auto-punch \
    --log-stream-name {} \
    --limit 100

Update Lambda

# Get ECR URI
ECR_URI=$(aws cloudformation describe-stacks \
  --no-cli-pager \
  --region ap-east-2 \
  --stack-name mayohr-auto-punch-ecr \
  --query "Stacks[0].Outputs[?OutputKey=='RepositoryUri'].OutputValue" \
  --output text)

# Login to ECR
aws ecr get-login-password \
  --no-cli-pager \
  --region ap-east-2 \
  | docker login \
    --username AWS \
    --password-stdin \
    ${ECR_URI}

# Pull latest image and push to ECR
docker pull --platform linux/amd64 justintw/mayohr-auto-punch:latest \
  && docker tag justintw/mayohr-auto-punch:latest ${ECR_URI}:latest \
  && docker push ${ECR_URI}:latest

# Update Lambda function
aws lambda update-function-code \
  --no-cli-pager \
  --region ap-east-2 \
  --function-name mayohr-auto-punch \
  --image-uri ${ECR_URI}:latest

# ⏳ Wait ~2 minutes for the Lambda function update to complete before invoking.
# You can check the status with:
aws lambda get-function-configuration \
  --no-cli-pager \
  --region ap-east-2 \
  --function-name mayohr-auto-punch \
  --query 'LastUpdateStatus'

# Invoke Lambda to test
aws lambda invoke \
  --no-cli-pager \
  --region ap-east-2 \
  --function-name mayohr-auto-punch \
  --payload '{}' \
  --cli-binary-format raw-in-base64-out \
  /dev/stdout

Telegram Notification (Optional)

To enable Telegram notifications:

  1. Create a Telegram bot through @BotFather
  2. Create a Telegram Channel and add the bot to it as an admin
  3. Get Channel ID from https://api.telegram.org/bot<bot_token>/getUpdates
  4. Add the following to your ~/.mayohr-auto-punch/.env file:
TELEGRAM_ENABLED="true"
TELEGRAM_BOT_TOKEN="your_bot_token"
TELEGRAM_CHAT_ID="your_chat_id"