Skip to content

Instantly share code, notes, and snippets.

View jsoma's full-sized avatar

Jonathan Soma jsoma

View GitHub Profile
@jsoma
jsoma / README.md
Last active April 25, 2024 14:57
How to use pandoc and Markdown to build a simple reveal.js presentation (and a bit about how to customize it, too)

Requirements

First you need to install pandoc.

I used brew install pandoc to install via Homebrew since I'm on a mac.

Writing your presentation

Make a slides.md for your slides (or name it whatever you want!). I put images in an /images/ folder. You can see how links and images and all of that work from this sample:

@jsoma
jsoma / Code.gs
Created March 6, 2024 11:36
Tiny little script to help you validate LLM responses in Google Sheets
function onOpen() {
const ui = SpreadsheetApp.getUi();
// Adds a custom menu to the Google Sheets UI
ui.createMenu('Checking helper')
.addItem('Create Sample', 'showStratificationPrompt')
.addToUi();
}
function showStratificationPrompt() {
const ui = SpreadsheetApp.getUi();
@jsoma
jsoma / matplotlib-fonts.py
Created July 10, 2018 03:37
See all of the fonts that matplotlib can access
import matplotlib.font_manager
from IPython.core.display import HTML
def make_html(fontname):
return "<p>{font}: <span style='font-family:{font}; font-size: 24px;'>{font}</p>".format(font=fontname)
code = "\n".join([make_html(font) for font in sorted(set([f.name for f in matplotlib.font_manager.fontManager.ttflist]))])
HTML("<div style='column-count: 2;'>{}</div>".format(code))
@jsoma
jsoma / Using paginated APIs (4 ways!).ipynb
Created June 27, 2021 14:01
Paginated APIs with Python: Four ways!
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jsoma
jsoma / README.md
Last active February 20, 2024 03:22
How to understand the margin convention and axes in d3+svg

How to understand the margin convention and axes in d3+svg

This walkthrough uses Homework 5: Question 10 as a base, but if you're just a random person from the internet it might still make sense

Let's say we do the totally normal height = and width = thing, and the totally normal svg = d3.select thing.

var height = 400
var width = 400
@jsoma
jsoma / README.md
Last active February 18, 2024 16:17
I promise the the command line is fun! It can be awful, sure, but also fun.

The command line is fun, I promise!

Let's do some fun stuff on the command line! This is a lot of "figuring out what to do" as opposed to "applying skills we learned in class." It will definitely make you feel uncomfortable and like you don't know anything, but that's okay!

Do these in any order you want. Be sure to check out the very last one, it's crazy.

A general tip: When you're searching around on the internet, pip install has a hundred ways of being talked about. python3 -m pip install and pipx install and pip3 install anything that vaguely looks like that can probably just be substituted with pip install.

ChatGPT can be really helpful for figuring out the specific command-line flags and arguments you need to get your CLI tools operating how you want them to. Unless you're using ffmpeg and convert every day of your life, memorizing exactly how these command-line tools work is prrrrrobably not the best use of your brainpower.

@jsoma
jsoma / index.html
Created December 2, 2023 20:12
Templates for auto-updating viz website
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The Bad Air Website</title>
<style>
body {
margin: 0;
background-color: aliceblue;
}

Command line fun hints and tips

Part 2: Command line data analysis

Installation

NOTE: Windows users will use scoop install instead of brew. Even if the docs say use choco, scoop is a better package manager than chocolatey!!!

Documentation + examples

@jsoma
jsoma / README.md
Last active January 25, 2024 14:44
Installing R that works in Jupyter without the 1997 American adventure horror thriller film Anaconda

Installing R in Jupyter notebooks without Anaconda

You need to already have Jupyter installed! If you don't have Python+Jupyter set up, you could use Python Wrangler or you can honestly just go install Anaconda to get started more quickly.

Download R

You can find it at https://cloud.r-project.org. It’s hard to figure out where exactly to go, so here are direct links that might be out of date:

@jsoma
jsoma / matplotlibrc
Created July 12, 2018 14:13
sample default matplotlibrc file from matplotlib
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overwritten in your next install.
# If you want to keep a permanent local copy that will not be
# overwritten, place it in the following location:
# unix/linux:
# $HOME/.config/matplotlib/matplotlibrc or