Skip to content

Instantly share code, notes, and snippets.

View jsoma's full-sized avatar

Jonathan Soma jsoma

View GitHub Profile
@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 / 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;
}
@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.

country continent life_expectancy population gdp gdp_per_capita
Afghanistan Asia 54.863 22856302 15153728226 663
Albania Europe 74.2 3071856 12886435920 4195
Algeria Africa 68.963 30533827 155661450046 5098
Angola Africa 45.234 13926373 34063908358 2446
Antigua and Barbuda N. America 73.544 77656 989182128 12738
Argentina S. America 73.822 36930709 390394524839 10571
Armenia Europe 71.494 3076098 6502871172 2114
Australia Oceania 79.93 19164351 560384787591 29241
Austria Europe 78.33 8004712 256214821696 32008

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
Created April 8, 2022 13:32
Use D3/JavaScript with ai2html: animating (and un-animating)

Maybe you styled a map in illustrator to look a certain way - the markers all have nice unique colors, opacity, etc etc. And then you plugged it into your scrollytelling piece: looking good so far.

On step 2 of your piece you want to change those markers: make them all yellow! Highlight them! #FFF880 is my favorite yellow highlight color. That's fine, normally you'd just do this to transition to the highlight color:

d3.selectAll("[data-name='africa'] path")
    .transition()
    .attr('fill', '#FFF880')
@jsoma
jsoma / ai2html-html.html
Created March 29, 2022 16:15
ai2html-html text block for illustrator
ai2html-html
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.3.0/d3.min.js"></script>
<style>
.hidden { visibility: hidden; }
</style>
@jsoma
jsoma / Downloading a list of files with Python.ipynb
Created December 7, 2021 17:13
How to download a list of files using Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jsoma
jsoma / stockx.ipynb
Created December 3, 2021 15:35
Basic StockX pandas analysis data and notebook. You can find the notebook here and the data here: https://s3.amazonaws.com/stockx-sneaker-analysis/wp-content/uploads/2019/02/StockX-Data-Contest-2019-3.xlsx
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.