Skip to content

Instantly share code, notes, and snippets.

View paulegan's full-sized avatar

Paul Egan paulegan

View GitHub Profile
@paulegan
paulegan / Code.gs
Created May 6, 2025 21:48
Apps Script for moving or copying Google Drive files (using Drive v3 for performance)
const PROCESS_FILE_DATE_THRESHOLD = new Date(2020, 1, 1)
const PROCESS_FILE_DESTINATION = 'xxx'
const PROCESS_FILE_CHUNK_SIZE = 100
const ADMIN_USER = '[email protected]'
// Defines criteria for processing each file
function shouldProcessFile(f) {
return new Date(f.modifiedTime) < PROCESS_FILE_DATE_THRESHOLD && f.ancestors.some(i => i.id == '1gJGndPkdUq5md61phIU2iiL6pHcMmO79')
// Could also use criteria like f.mimeType.includes('pdf')
@paulegan
paulegan / ical2csv.py
Created March 24, 2022 00:30
Convert ical file to a csv
import sys
import csv
import icalendar
with open(sys.argv[1]) as f:
cal = icalendar.Calendar.from_ical(f.read())
with open(sys.argv[2], 'w') as f:
csv.writer(f).writerows(
(
import sys
import numpy as np
import pandas as pd
df = pd.read_csv(sys.argv[1], dtype=str)
debaters = [(topic, set(df['Name'][df[topic] == 'Yes'])) for topic in df.columns[2:]]
np.random.shuffle(debaters)
attendees = set()
picked = set()
@paulegan
paulegan / Location History.ipynb
Last active July 2, 2018 13:19
Location History
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paulegan
paulegan / _INSTAPAPER TO FEEDLY_ README.md
Last active March 14, 2023 23:44
Script to that takes Instapaper csv export and imports to Feedly as new entries under a board/tag
@paulegan
paulegan / dabblet.css
Created December 5, 2017 21:47
Untitled
background-image: linear-gradient(45deg, transparent 50%, rgba(0,0,0,0.1) 50%),
linear-gradient(to bottom right, #1ad162, #68d162, #dfc056, #e55727, #d2100b);
background-size: 5vw 5vw, 100vw 100vh;
color: white;
@paulegan
paulegan / settings.py
Created October 20, 2015 15:08
Example of decrypting configuration variables in Python settings file
import os
try:
from Crypto.Cipher import AES as aes
key, iv = os.environ['SETTINGS_KEY'].split(':')
except (ImportError, KeyError):
def _decrypt(s):
return s
else:
def _decrypt(s):
@paulegan
paulegan / modules.txt
Last active August 29, 2015 14:21
baked.js escaping issue
[email protected]:
ecstatic:[email protected]:
ecstatic/node_modules/he:[email protected]:
ecstatic/node_modules/mime:[email protected]:
ecstatic/node_modules/minimist:[email protected]:
ejs:[email protected]:
gulp:[email protected]:
gulp/node_modules/archy:[email protected]:
gulp/node_modules/chalk:[email protected]:
gulp/node_modules/chalk/node_modules/ansi-styles:[email protected]:
@paulegan
paulegan / bookmarklet.js
Last active March 5, 2017 00:39
Bookmarklet for sorting feedly entries by engagement
javascript:(function () {
function engagement(entry) {
var e = entry.querySelector('[data-dot="engagement-count"]');
if (e) {
var t = e.innerText;
var x = t[t.length - 1] === 'K' ? 1000 : 1;
return parseInt(t) * x;
} else {
return 0;
}
#!/usr/bin/env python
import sys
import os
import glob
from distutils.cmd import Command
from distutils.command.build import build
from setuptools.command.install import install
from setuptools import setup, find_packages