Skip to content

Instantly share code, notes, and snippets.

@shaunagm
shaunagm / snippets.py
Created February 2, 2023 00:58
snippets for Parsons "Intro to Python" training
View snippets.py
# Here's some data to play with!
data = [
{'first_name': 'Megan', 'last_name': 'Rapinoe', 'age': '37', 'date_updated': '1674121763'},
{'first_name': 'Tobin', 'last_name': 'Heath', 'age': '34', 'date_updated': '1664121763'},
{'first_name': 'Crystal', 'last_name': 'Dunn', 'age': '31', 'date_updated': '1664121763'},
{'first_name': 'Midge', 'last_name': 'Purce', 'age': '26', 'date_updated': '1664121763'},
{'first_name': 'Sophia', 'last_name': 'Smith', 'age': '23', 'date_updated': '1664121763'}
]
@shaunagm
shaunagm / digidems_demo_script.py
Created August 17, 2022 17:41
demo script for digidems webinar Aug 2022
View digidems_demo_script.py
#############
### SETUP ###
#############
from parsons import MobilizeAmerica, GoogleSheets
mobilize = MobilizeAmerica()
sheets = GoogleSheets() # don't forget to set GOOGLE_DRIVE_CREDENTIALS environmental variable
@shaunagm
shaunagm / day3script.py
Created July 14, 2022 16:35
Script for Day 3 of Intro to Parsons Training
View day3script.py
from parsons import MobilizeAmerica, ActionNetwork, GoogleSheets, Table
#########################
### Getting your data ###
#########################
"""Typically you'd load data directly from your third party platform:"""
# mobilize = MobilizeAmerica()
@shaunagm
shaunagm / day2script.py
Last active July 13, 2022 21:13
Script for Day 2 of Intro to Parsons Training
View day2script.py
##############################
### Get data from Mobilize ###
##############################
from parsons import MobilizeAmerica
"""Don't forget to set the MOBILIZE_AMERICA_API_KEY environment variable"""
mobilize = MobilizeAmerica()
mobilize.uri = "https://staging-api.mobilize.us/v1/" # only necessary since we're using a "developer sandbox"
@shaunagm
shaunagm / repower_parsons_training.py
Created July 9, 2022 18:54
Sample code for the re:power parsons training
View repower_parsons_training.py
"""
This file functions as a brief introduction to Parsons. To install Parsons, follow this
guide: https://parsons.pubpub.org/installation. If you're used to installing with pip, the tldr is
"pip install parsons".
"""
# print("Let's do this!")
@shaunagm
shaunagm / etl_training_script.py
Last active May 4, 2022 21:17
Script for "Intro to ETL" Training (Part 1)
View etl_training_script.py
#-----------------------------------------------------------
# Import Necessary Packages
#-----------------------------------------------------------
import json
from parsons import Table, MobilizeAmerica, GoogleSheets
from datetime import datetime
#-----------------------------------------------------------
# Instantiate Classes/Connect to Mobilize and Google Sheets
@shaunagm
shaunagm / script.py
Created April 21, 2022 16:33
Parsons authentication training script
View script.py
"""
This script was created for the Parsons "All About Authentication" training.
"""
from parsons import Table, Twilio, GoogleSheets
twilio = Twilio()
sheets = GoogleSheets()
# Get data from google sheets
View voter_file.py
from parsons import Table
# Download NC Voter data file from: https://s3.amazonaws.com/dl.ncsbe.gov/data/ncvoter_Statewide.zip
# Extract (very large, I had to use an external haard drive)
# load the file into a Parsons table
# note #1 - need to specify encoding as it's not default UTF-8
# used "file -i ncvoter_Statewide.txt" on Linux to find file's encoding which was charset=iso-8859-1
# python codecs list says charset=iso-8859-1 is called latin_1
@shaunagm
shaunagm / organizing_references.md
Last active March 20, 2021 20:31
Tech Worker Organizing Resources
View organizing_references.md

Compiled by Shauna Gordon-McKeon, with contributions from Amanda Jaret, Marley Pulido-Vargas and Lauren Burke.

Quick Intro

The National Labor Relations Act gives most tech workers the right to organize and join a union. It also protects your right to take other collective actions to protect you and your coworkers on the job. Here are a few examples of actions that may be protected by the National Labor Relations Act:

  • Talking to your coworkers about your salary, benefits, or other working conditions.
  • Writing a petition on behalf of a group of coworkers to your boss to ask for a raise.
  • Publicizing a workplace issue that you and your coworkers share on social media.
  • Organizing a union with your coworkers and asking the company to recognize and bargain with the union.
@shaunagm
shaunagm / codelibs_iteration_3.rkt
Last active February 18, 2021 20:38
codelibs_iteration_3.rkt
View codelibs_iteration_3.rkt
#lang at-exp racket
(require (for-syntax racket/match))
(require (for-syntax racket/syntax))
(define-namespace-anchor anc)
(define ns (namespace-anchor->namespace anc))
; with adjusted macros from text madlibs