Skip to content

Instantly share code, notes, and snippets.

@elijahr
elijahr / is-final-node.py
Created September 28, 2022 09:54
Script for determining if the currently running CircleCI node is the last running node
#!/usr/bin/env python3
"""Script for determining if the currently running CircleCI node is the last
running node.
Useful for when some action should be performed after parallel jobs have completed with errors.
A `CIRCLE_TOKEN` environment variable must be present.
The API token can be created at https://app.circleci.com/settings/user/tokens
and placed in an environment variable in your Organization Settings under "Contexts".
@elijahr
elijahr / nimble-test.yaml
Last active October 11, 2021 08:32
Drop-in multi-architecture testing for Nim projects
# Drop-in multi-architecture testing for Nim projects.
# To use, copy to `.github/workflows/` & enable via Settings → Actions → Allow.
# Push changes to run `nimble test`.
# Tests macos/ubuntu, glibc/musl, gcc/clang and x86/arm/ppc.
# Configure nim-version, os, libc, arch, & cc in ##matrix sections.
# Extra dependencies? Update ##extra-deps sections.
# Author: https://github.com/elijahr
# Source: https://gist.github.com/elijahr/66e7f4db1e3f474689c4f72deb1191d3
@elijahr
elijahr / meme_search.py
Last active June 22, 2021 02:44
Use OCR to search for text in your library of downloaded memes
#!/usr/env/bin python3
try:
from PIL import Image
except ImportError:
import Image
import os
import mimetypes
import sys
@elijahr
elijahr / copy-as-mp3
Last active May 14, 2021 22:12
scripts for copying folders of multiple audio file types to mp3 playlists. so for instance, if you have a large library of lossless (WAV, FLAC, etc) files and want to copy them to a portable mp3 player with limited space.
#!/usr/bin/env python3
import argparse
import asyncio
import multiprocessing
import mimetypes
import os
import shlex
import shutil
import sys
@elijahr
elijahr / merge-docker-compose-configs.py
Last active February 2, 2021 03:51
Python script to merge multipe docker-compose configs into a single config
import argparse
import sys
from collections import OrderedDict
from ruamel.yaml import YAML
yaml = YAML()
@elijahr
elijahr / example.yml
Last active December 6, 2020 03:37
Interpolates aliases in YAML
_anchors:
checkout_repo: &checkout_repo
name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 1
submodules: recursive
install_pip_requirements: &install_pip_requirements
@elijahr
elijahr / .travis.yml
Last active August 29, 2020 17:23 — forked from genotrance/travis.sh
Travis CI setup for Nim
os: linux
dist: bionic
language: c
matrix:
include:
# Linux - amd64
- env: BRANCH=0.20.2
- env: BRANCH=1.0.8
- env: BRANCH=1.2.6
#!/bin/sh
# A custom script which adds entries to LSApplicationQueriesScheme, for
# whitelisting application schemes that can be used to trigger FB/Instagram/etc
# shares. We can't use <config-file> directive in config.xml because
# cordova-plugin-facebook4 overwrites our custom values in the resulting
# *-Info.plist file. To add schemes to LSApplicationQueriesScheme, add
# them to the schemes array below.
# To enable this script, add hooks to your config.xml:
@elijahr
elijahr / README.md
Last active July 11, 2024 20:16
Bookmarklet to parse `py.test` failures from a CircleCI build page and generate a command to re-run those tests locally.

parseTestFailures.js

A bookmarklet to parse py.test failures from a CircleCI build page and generate a command to re-run those tests locally.

Installation

Create a bookmark with the following URL:

javascript:(function()%7Bfunction%20requireJQuery(fn)%20%7B%0A%20%20if%20(window.jQuery)%20%7B%0A%20%20%20%20fn()%3B%0A%20%20%7D%20else%20%7B%0A%20%20%20%20console.log(%22No%20jQuery%20available%20yet%2C%20retrying%20in%201s%22)%3B%0A%20%20%20%20if%20(!document.getElementById(%22jquery-script%22))%20%7B%0A%20%20%20%20%20%20var%20script%20%3D%20document.createElement(%22script%22)%3B%0A%20%20%20%20%20%20script.setAttribute(%22id%22%2C%20%22jquery-script%22)%3B%0A%20%20%20%20%20%20script.setAttribute(%22src%22%2C%20%22%2F%2Fcode.jquery.com%2Fjquery.js%22)%3B%0A%20%20%20%20%20%20document.getElementsByTagName(%22body%22)%5B0%5D.appendChild(script)%3B%0A%20%20%20%20%7D%0A%20%20%20%20setTimeout(requireJQuery.bind(this%2C%20fn)%2C%201000)%3B%0A%20%20%7D%0A%7D%0A%0Afunction%20parseTestFailures()%20%7B%0A%20%2
@elijahr
elijahr / gist:3165026
Created July 23, 2012 17:59
activate virtualenvs automatically
#### automatically activate virtualenvs named 'pyenv'
#### just put this at the end of your ~/.bashrc file
workon_virtualenv() {
if [ -e "${PWD}/pyenv" ]; then
deactivate >/dev/null 2>&1
source "${PWD}/pyenv/bin/activate"
fi
}
virtualenv_cd() {