Skip to content

Instantly share code, notes, and snippets.

View lsloan's full-sized avatar

Mr. Lance E Sloan «UMich» lsloan

  • Teaching and Learning (@tl-its-umich-edu) at University of Michigan: Information and Technology Services
  • Ann Arbor, Michigan, USA
  • 17:41 (UTC -05:00)
  • X @lsloan_umich
View GitHub Profile
@lsloan
lsloan / pycon_pdf_to_png.py
Last active May 22, 2024 01:41
A small program to convert the PDF of the PyCon US 2024 venue map to individual PNG images.
import urllib.request
import pymupdf # pip install PyMuPDF
url = ('https://pycon-assets.s3.amazonaws.com/2024/media/'
'documents/DLCC-Floorplan-Marked_up_PyCon_US_2024.pdf')
# url = 'file:DLCC-Floorplan-Marked_up_PyCon_US_2024.pdf'
with urllib.request.urlopen(url) as response:
pdfStream = response.read()

Mathematical Summations in Python

Problem

I saw a video that claimed the following mathematical summation…

$$\sum_{\substack{i=0 \\ i\neq 4}}^{n} i$$
@sloanlance
sloanlance / clone-private-github-repo-in-google-colab.ipynb
Last active July 16, 2024 04:28
clone-private-github-repo-in-google-colab.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sloanlance
sloanlance / yq Notebook.md
Last active September 29, 2023 14:35
Useful notes about using yq

yq Notebook

Useful notes about using yq

  1. Display the path to each value in a YAML file
    $ cat << EOF | yq e '.. | select(. == "*") | {(path | join(".")): .} ' -
    > a:
    >   b: foo

> c: bar

@lsloan
lsloan / umich-udp-bigquery-to-pandas-dataframe.ipynb
Last active July 19, 2023 02:46
umich-udp-bigquery-to-pandas-dataframe.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lsloan
lsloan / copy-of-pandas-101-data-cleaning-in-pandas.ipynb
Last active July 18, 2023 02:42
Copy of Pandas 101 - Data Cleaning in Pandas.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lsloan
lsloan / cisco-anyconnect-auto-login.md
Created May 13, 2022 15:35 — forked from zenglian/cisco-anyconnect-auto-login.md
auto login with cisco anyconnect (password saved, silent mode)

Cisco AnyConnect: auto login in silent mode

This gist is for Linux. For windows is the same thing.

Connect

create a file .login_info as below:

connect your.server.url    
usernanme 
@benkehoe
benkehoe / timedelta_iso.py
Last active December 22, 2022 17:54
IS8601 functions for datetime.timedelta
# MIT No Attribution
#
# Copyright 2022 Ben Kehoe
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so.
#
@lsloan
lsloan / ! Python QTI.md
Last active April 10, 2023 21:11 — forked from IanHopkinson/lxml_examples.py
QTI data processing in Python; examples using pyslet, beautifulsoup4, and lxml.

Examples of processing QTI data with Python.

I attempted to use pyslet, which was designed for this purpose, but I found it awkward to use and its documentation unclear. Instead, I tried to use beautifulsoup4, but I learned that library doesn't support XPath to query for specific elements of the data. I turned to using the simple XML processing library lxml. It has similarities to other XML parsing libraries I've used before, but it has many unique features of its own.

Note that of the examples below, each does something a little differently. They don't all have the same output.
That's because they were mostly tests to see whether we preferred working with one library over another. Some

version: '3'
services:
jupyter:
container_name: my_jupyter
#image: jupyter/datascience-notebook
image: jupyter/minimal-notebook
ports:
- '127.0.0.1:8888:8888'
environment: