This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onOpen() { | |
SlidesApp.getUi() | |
.createMenu("Scripts") | |
.addItem("Skip/Unskip by Numbers", "unskipByNumbers") | |
.addToUi(); | |
} | |
/** Prompts the user for slide numbers. Unskips all of the specified slides. Skips the rest. */ | |
function unskipByNumbers() { | |
var ui = SlidesApp.getUi(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The following are custom Google Sheets functions to scrutinize judges' data for a ballroom competition. | |
// They are designed to work with Google Forms responses. See each function's description below for | |
// instructions on setting up the Google Forms question. | |
// | |
// More info on custom functions: https://developers.google.com/apps-script/guides/sheets/functions | |
// More info on the system for scoring ballroom competitions: https://en.wikipedia.org/wiki/Skating_system | |
/** | |
* Counts the number of marks for each competitor in a qualifying (non-final) round of a single-dance event. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import datetime | |
import humanfriendly # pip install humanfriendly | |
import os | |
import shutil | |
import subprocess | |
import sys | |
import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' | |
This script demonstrates some basic inter-process communication. Typical usage: | |
1. Run this script with the "make" argument. On Windows, a new console window | |
will appear; that is the worker. Copy the last line of the output from this | |
window to the clipboard. | |
2. Run this script with the "query" argument and paste the last line of the | |
output from the last step as the second argument. Repeat this step as many | |
times as you want. After the worker finishes, repeating this step will cause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name NJ Transit Train Schedule Station Persister | |
// @namespace https://www.wecsam.com/ | |
// @version 0.1 | |
// @description This script fills the origin and destination fields with the last values that you entered. | |
// @author You | |
// @match https://www.njtransit.com/sf/sf_servlet.srv?hdnPageAction=TrainTo | |
// @match https://www.njtransit.com/sf/sf_servlet.srv?hdnPageAction=TrainTo# | |
// @grant none | |
// ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import flask | |
app = flask.Flask(__name__) | |
HTML_HOME = """<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse, collections, os.path, sys | |
def move_lines(fin, fout, lines_to_leave, preserve_first_line): | |
# For CSV files, preserve the first line, which is the header row. | |
if preserve_first_line: | |
first_line = next(fin) | |
else: | |
first_line = "" | |
# If the output file is new, write the first line into it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# pip install z3-solver | |
import z3 | |
class OrdAt: | |
''' | |
Z3 has no way of arbitrarily getting a character at an index from a string. | |
However, this problem requires us to get ASCII character codes from a | |
string. When an object of this class is called, the return value is a | |
BitVec with a number of bits that you specify; the 8 least significant bits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse, gettext, sys | |
class FileType(argparse.FileType): | |
''' | |
This class is just like argparse.FileType, except that it supports all | |
keyword arguments for open() and returns a function that opens a handle | |
rather than returning the handle itself. This means that the file is not | |
actually opened until that function is called. This also means that the | |
result can be used with a "with" block. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
''' | |
Import this module to ensure that at most one instance of the main script can | |
be running at once. If another instance is detected, sys.exit() will be called. | |
The psutil package is required: pip install psutil | |
''' | |
import atexit, logging, math, os, psutil, socket, sys | |
logger = logging.getLogger("prevent_parallel") | |
PID_FILE = \ |
NewerOlder