Skip to content

Instantly share code, notes, and snippets.

@billyeh
billyeh / sync_emails.js
Last active April 5, 2022 04:06
Sync Google group/email list
const GMAILS_EMAILS = ``.toLowerCase(); // List of emails from GMail to: line.
const GMAIL_EMAILS = GMAILS_EMAILS.split(',\n').map(
email => email.substring(
email.indexOf("<") + 1,
email.lastIndexOf(">")
));
const GROUPS_EMAILS = ``.toLowerCase(); // List of emails from Groups CSV download.
from typing import Iterable, Optional, Tuple
import unittest
def longest_substring_with_two_characters(s: str) -> Optional[Tuple[int]]:
"""Finds the longest substring in s that contains up to 2 distinct characters."""
substring_start = 0
current_index = 0
other_char = None
continuous_substring_start = 0
@billyeh
billyeh / outline_formatter.gs
Last active December 30, 2021 00:26
Format text outlines in Google Docs (from PDF conversions)
/**
* Convenient script for formatting Google Docs converted from outline PDF files.
* Simply copy/paste the outline text, and the script cleans up the whitespace
* and correctly formats the document according to the Roman numerals found
* in the text.
/**
* Calculates all the next Roman numeral strings we expect.
* @return {Array} List of outline point strings to search the
* document for. For example, [' I. ', ' C. ', ' 1. '].
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@billyeh
billyeh / flatbible.ipynb
Last active July 11, 2017 20:15
Parse the Recovery Version to create a flat Bible
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@billyeh
billyeh / photosend.py
Last active May 8, 2017 17:16
Simple way to deliver photos by email using facebook image recognition
import requests
import json
import fnmatch
import os
import ast
import httplib2
import mimetypes
import base64
import logging
@billyeh
billyeh / clock.html
Last active January 9, 2017 22:29
Clock with seconds and carousel of background images
<html>
<body onload="main()" style="margin:0; background-color:black; font-family:sans-serif;">
<div id="body" style="width:100%; height:100%; background-image:url(image1.jpg); background-size:cover">
<div style="position:absolute; top:50%; color:white; margin-left:3%">
<div>
<span id="time"></span>
<span id="secs"></span>
</div>
<div id="date"></div>
</div>
@billyeh
billyeh / pptToPdf README
Last active August 29, 2015 14:12
README for Powerpoint to PDF Converter
PDF Print
=========
##Installation
Install easily on a Windows machine:
1. Download and install a compatible version of [Python](https://www.python.org/downloads/).
(Make sure the Python.exe file is added to the PATH variable. This is one of the
installation options.)
2. Find the release of [Python for Windows Extensions](http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/)
@billyeh
billyeh / pptToPdf
Last active August 29, 2015 14:12
Powerpoint to PDF Converter
import sys
import argparse
import os
import fnmatch
import win32com
from Tkinter import *
from tkFileDialog import *
from win32com.client import Dispatch