Skip to content

Instantly share code, notes, and snippets.

View antoniosb's full-sized avatar

Antônio Augusto antoniosb

View GitHub Profile
@antoniosb
antoniosb / add-team-to-repos.js
Last active April 9, 2024 18:55 — forked from davidrleonard/add-team-to-repos.js
Add a new team to all Github repos in an organization
/*
* Adds a team to all the repos in a Github organization. This is a tedious
* process in the UI. You'll need a newer version of node to run this (e.g 9+)
* because it uses async/await.
*
* Instructions:
*
* 1. Copy this file somewhere on your computer, e.g. ~/addteamrepos.js
* 2. Fill in the uppercase variables below with the right values
* 3. Run this file: `$ node ~/addteamrepos.js`
@antoniosb
antoniosb / parse_pdf_date.sql
Created March 24, 2025 23:01
PL/pgSQL function that parses PDF timestamps
CREATE OR REPLACE FUNCTION parse_pdf_date(pdf_date TEXT) RETURNS TIMESTAMP WITH TIME ZONE AS $$
DECLARE
timestamp_part TEXT;
tz_offset TEXT;
clean_tz_offset TEXT;
parsed_timestamp TIMESTAMP;
BEGIN
-- Return NULL if the input is NULL or does not start with 'D:'
IF pdf_date IS NULL OR pdf_date !~ '^D:\d+' THEN
RETURN NULL;