This file contains 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
#!/Users/jvkersch/miniconda3/envs/google-photos/bin/python | |
# Script to upload folders of photos to Google Photos | |
# Written with ChatGPT. | |
# | |
# Requires a Python environment with Google API packages: | |
# pip install google-auth google-auth-oauthlib google-auth-httplib2 requests | |
import os | |
import requests |
This file contains 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
import os | |
import shutil | |
def parse_dirname(dirname): | |
_, raw_name, _ = dirname.split(" - ") | |
parts = raw_name.split() | |
parts = [parts[-1]] + parts[:-1] | |
return " ".join(parts) |
This file contains 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
import argparse | |
import sys | |
from Bio import SeqIO | |
def _parse_args(): | |
p = argparse.ArgumentParser() | |
p.add_argument("input") | |
return p.parse_args().input |
This file contains 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
package main | |
import ( | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"os" | |
"path/filepath" | |
) |
This file contains 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
import abc | |
import asyncio | |
class MessageBox: | |
def __init__(self): | |
self._queue = asyncio.Queue() | |
async def send(self, message_type, *content): | |
await self._queue.put((message_type, content)) |
This file contains 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
IDENTIFICATION DIVISION. | |
PROGRAM-ID. AOC1. | |
ENVIRONMENT DIVISION. | |
INPUT-OUTPUT SECTION. | |
FILE-CONTROL. | |
SELECT INPUTFILE ASSIGN TO 'input' | |
ORGANIZATION IS LINE SEQUENTIAL. | |
DATA DIVISION. |
This file contains 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
# EDM prettified prompts and autocompletions for the Fish shell | |
# Copyright (C) 2020 Joris Vankerschaver | |
# SPDX-License-Identifier: BSD-3-Clause | |
# | |
# Based on the autocompletions for Conda, generated with 'conda init fish' | |
# Copyright (C) 2012 Anaconda, Inc | |
# SPDX-License-Identifier: BSD-3-Clause | |
# | |
# USAGE INSTRUCTIONS | |
# |
This file contains 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
import nibabel as ni | |
from mayavi import mlab | |
from tvtk.api import tvtk | |
from tvtk.pyface.scene import Scene | |
from mayavi.sources.api import VTKDataSource | |
# Standard imports. | |
from numpy import sqrt, sin, mgrid |
This file contains 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
import functools | |
import os | |
import stat | |
import subprocess | |
import threading | |
from traits.api import ( | |
Any, Bool, Button, Dict, Event, HasStrictTraits, | |
Instance, Int, List, Property, Str, Tuple, Union, | |
observe |
This file contains 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
""" Infinite sieve of Eratosthenes using generators. | |
Python version of the Scheme code in SICP, paragraph 3.5.2. | |
""" | |
def primes(integers): | |
first = next(integers) | |
yield first | |
yield from primes(i for i in integers if i % first != 0) |
NewerOlder