Skip to content

Instantly share code, notes, and snippets.

const getAttendanceData = (sheet) => {
const lastColumn = sheet.getLastColumn();
const heading = sheet.getRange("A1:" + sheet.getRange(1, lastColumn).getA1Notation()).getValues()[0];
const data = sheet.getRange("A3:" + sheet.getRange(1, lastColumn).getA1Notation() + sheet.getLastRow()).getValues();
// Find the start date for the last 12 weeks
const today = new Date();
const twelveWeeksAgo = new Date(today.setDate(today.getDate() - 84));
// Filter the headings to get the columns within the last 12 weeks
@punchagan
punchagan / .gitignore
Last active February 23, 2024 15:22
Zoom Meetings Command Line
/.mypy_cache/
/.envrc
@punchagan
punchagan / hello.py
Last active December 21, 2023 23:36
A simple Flask sockets example
# Copy of http://stackoverflow.com/a/20104705
from flask import Flask, render_template
from flask_sockets import Sockets
app = Flask(__name__)
app.debug = True
sockets = Sockets(app)
@sockets.route('/echo')
@punchagan
punchagan / .gitignore
Last active November 29, 2023 12:26
Whatsapp Broadcast Export to Zulip
*.zip
*.jpg
/*.txt
2023-07-05 18:38.18: New job: Build bench.Dockerfile using autumn in
[https://github.com/ocaml/dune.git#refs/heads/main (bb0668329ee4a48bdd7727703ca131f025070e5e)]
2023-07-05 18:38.18: Using cache hint "https://github.com/ocaml/dune.git-bench.Dockerfile"
2023-07-05 18:38.18: Waiting for resource in pool OCluster
2023-07-05 18:38.18: Waiting for worker…
2023-07-05 18:38.18: Got resource from pool OCluster
Building on development-worker
HEAD is now at 2ff88051c bench: add GC stats to bench
HEAD is now at bb0668329 refactor: use Path.External.t for dump_memo_graph_file (#8117)
#1 [internal] load build definition from bench.Dockerfile
@punchagan
punchagan / .gitignore
Last active April 9, 2022 09:46
Ocurrent logs line numbers
/__pycache__/
@punchagan
punchagan / scrape_google_groups.py
Last active February 19, 2022 13:23
A simple script to scrape a google group.
import json
from os.path import exists
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException
class GoogleGroupsScraper(object):
""" A simple class to scrape a google group. """
@punchagan
punchagan / upai-topscore.py
Created August 3, 2019 15:58
UPAI topscore request example
import requests
import json
# Obtain this from https://upai.usetopscore.com/u/oauth-key
client_id = 'XXX'
client_secret = 'YYY'
data = {
'grant_type': 'client_credentials',
@punchagan
punchagan / nikola-to-hugo.py
Last active December 7, 2019 05:53
Nikola to Hugo tools
#!/usr/bin/env python3
""" Script to convert a Nikola blog to Hugo
Requirements:
- toml
Usage:
./nikola-to-hugo.py /path/to/nikola/blog
@punchagan
punchagan / prepare-commit-msg.sh
Last active April 23, 2019 04:01 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test release/candidate)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"