Skip to content

Instantly share code, notes, and snippets.

View janeadams's full-sized avatar

Jane Adams janeadams

View GitHub Profile
@janeadams
janeadams / tracker.py
Created December 29, 2021 03:09
Gas tracker
import requests
import datetime as dt
import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library
from time import sleep # Import the sleep function from the time module
GPIO.setwarnings(False) # Ignore warning for now
GPIO.setmode(GPIO.BOARD) # Use physical pin numbering
pins = [23,21,19]
for pin in pins:
GPIO.setup(pin, GPIO.OUT, initial=GPIO.LOW)
while True:
---
title: Irydium ❤️ Synesthesia
scripts:
- https://cdn.plot.ly/plotly-latest.min.js
- https://d3js.org/d3-dsv.v1.min.js
components:
- https://github.com/irydium/irdium/files/blah/document.md#PlotlyGraph
variables:
- midi_url: https://raw.githubusercontent.com/janeadams/synesthesia/master/audio/midi/dancingqueen.mid
data:
@janeadams
janeadams / tictactoe.py
Last active March 12, 2021 13:18
TicTacToe - Recurse Interview
def printBoard(board, game):
print(f"Game #{game}. Board configuration:\n {' '.join([str(c) for c in board[:3]])}\n {' '.join([str(c) for c in board[3:6]])}\n {' '.join([str(c) for c in board[6:]])}\n")
def checkWin(board, game):
printBoard(board, game)
routes = [board[:3], board[3:6], board[6:]] # Rows of board
columns = [board[::3],board[1::3],board[2::3]] # Columns of board
routes.extend(columns)
diagonals = [[board[0],board[4],board[8]],[board[2],board[4],board[6]]] # Diagonals of board
routes.extend(diagonals) # Routes = all possible routes to a win-state
@janeadams
janeadams / sample_json_parse.py
Last active May 20, 2021 18:01
Sample JSON Parse from UI Download, for StoryWrangler
import json
import pandas as pd
import csv
dfs={}
with open('storywrangler_data.json') as json_file:
data = json.load(json_file)
for ngram in data['metadata']['ngrams']:
@janeadams
janeadams / sample_api_request.py
Created July 28, 2020 03:46
Sample API Request for StoryWrangler
import requests
import json
import pandas as pd
import csv
query = "one two three four"
language = "es"
metric = "rank"
rt = "false"