Skip to content

Instantly share code, notes, and snippets.

View adfindlater's full-sized avatar

Alex Findlater adfindlater

  • Insurance Quantified
  • Michigan, USA
View GitHub Profile
# RUN git config --global url."https://$GITHUB_TOKEN@github.com/".insteadOf "https://github.com/"
@adfindlater
adfindlater / yaml_to_docker_env_file.py
Last active October 27, 2021 20:41
Convert a YAML file into a file that defines environment variables for a Docker container (`*.env`).
#!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import yaml
def convert_yaml_to_docker_env(
yaml_path: str, env_path: str = "/tmp/tmp.env", uppercase_keys: bool = False
):
"""Read & convert a YAML file into a docker environment variable file. This
@adfindlater
adfindlater / qutemacs.py
Created June 29, 2021 16:06 — forked from jumper047/qutemacs.py
Qutebrowser config with emacs key bindings
# qutemacs - a simple, preconfigured Emacs binding set for qutebrowser
#
# The aim of this binding set is not to provide bindings for absolutely
# everything, but to provide a stable launching point for people to make their
# own bindings.
#
# Installation:
#
# 1. Copy this file or add this repo as a submodule to your dotfiles.
# 2. Add this line to your config.py, and point the path to this file:
@adfindlater
adfindlater / sns_sms_shopper.py
Last active December 18, 2020 20:19
Publish an SNS message to SMS subscribers when the Savannah colored Scuba Oversized Zip Hoodie is in stock.
import boto3
import time
import requests
from bs4 import BeautifulSoup
colors = ["Savannah"]
URL = "https://shop.lululemon.com/p/womens-outerwear/Scuba-Oversized-12-Zip-Hoodie/?sz=XS%2FS"
sns_arn = ""
while True:
@adfindlater
adfindlater / run_regression.py
Created September 21, 2020 19:30
Minimal BERT regression model
# coding=utf-8
#
# Minimal BERT regression model
#
# Code borrowed from huggingface text-classification example (original licence follows):
# https://github.com/huggingface/transformers/blob/master/examples/text-classification/run_glue.py
#
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
from bs4 import BeautifulSoup
from pprint import pprint
import urllib.request
site = "https://en.wikipedia.org/wiki/Ryder"
hdr = {"User-Agent": "Mozilla/5.0"}
req = urllib.request.Request(site, headers=hdr)
page = urllib.request.urlopen(req)
soup = BeautifulSoup(page.read())
@adfindlater
adfindlater / searchablePDF.py
Created October 27, 2019 22:56
Generate a searchable PDF using Tesseract 4.0
import pytesseract
import argparse
import os
from pdf2image import convert_from_path
from PyPDF2 import PdfFileMerger
from progressbar import ProgressBar
def create_searchable_pdf(images: list, output_path: str):
sudo mount -t cifs //10.0.0.1/Data ~/airport -o password=XXX,sec=ntlm,username=YYY,vers=1.0
@adfindlater
adfindlater / peek.py
Created August 4, 2019 18:19
gmail_peek for Rofi
#!/usr/bin/python3
from __future__ import print_function
import pickle
import codecs
import os.path
import datetime
from rofi import Rofi
from typing import Dict