Skip to content

Instantly share code, notes, and snippets.

View csbailey5t's full-sized avatar

Scott Bailey csbailey5t

View GitHub Profile
@csbailey5t
csbailey5t / speakingincode.notes.md
Created November 8, 2013 19:52
Here are my notes (with additions from Bethany Nowviskie) from the recent Speaking in Code conference at the University of Virginia Scholars' Lab

Speaking in Code - Conference Notes

Bethany's Intro

An event long time in coming...

We are at a crossroads moment in DH, where there is a lot of pressure on traditional scholars to learn digital tools and methods. Obligation on DH developers to match that with better articulation of what does unspoken in their craft.

Large disjunct in this explosion of interest. Expectations and stereotypes from the larger industry (Silicon Valley) are being laid over humanities software developers. Also questions about relation of traditional humanities modes of work and interpretive concerns to digital humanities developers' work.

UPDATE `omeka_users` SET `password`=sha1(concat(`salt`, 'NEW_PASSWORD')) WHERE `username`='USER';
@csbailey5t
csbailey5t / keybase.md
Created September 30, 2014 17:09
keybase.md

Keybase proof

I hereby claim:

  • I am csbailey5t on github.
  • I am csbailey5t (https://keybase.io/csbailey5t) on keybase.
  • I have a public key whose fingerprint is BAE6 7D4F E7D9 E4E1 7993 A0AC BCDA 7043 DFE7 BDA5

To claim this, I am signing this object:

@csbailey5t
csbailey5t / Uninstall local node modules
Created February 26, 2015 19:39
Bash to uninstall all local node_modules; run from directory containing package.json
for package in `ls node_modules/`; do npm uninstall $package; done;
mysqldump courtesy of waynegraham
mysqldump -h [host] -u [user] --password=[password] [database] | gzip -c | cat > ~/Desktop/`date +%Y-%m-%d-%T`.sql.gz
mysqldump -h [host] -u [user] --password=[password] [database] | gzip -c | cat > ./`date +%Y-%m-%d-%T`.sql.gz
mysqldump -h [host] -u [user] --password=[password] [database] | gzip -c | cat > ~/Desktop/`date +%Y-%m-%d-%T`.sql.gz
mysqldump -h [host] -u [user] --password=[password] [database] | gzip -c | cat > ./`date +%Y-%m-%d-%T`.sql.gz
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]
@csbailey5t
csbailey5t / image-compare.py
Created May 7, 2018 17:23
image-compare for histonets
# coding: utf-8
# In[ ]:
#following code here: https://www.pyimagesearch.com/2017/06/19/image-difference-with-opencv-and-python/
# In[1]:
@csbailey5t
csbailey5t / docx2txt.py
Created July 23, 2019 20:36
Convert docx files in a directory to plain text
import glob
import docx
def get_text(fn):
doc = docx.Document(fn)
fulltext = []
for para in doc.paragraphs:
fulltext.append(para.text)
return "\n".join(fulltext)
@csbailey5t
csbailey5t / corelogic_nulls.py
Created November 11, 2019 23:04
Import a CoreLogic pipe delimited file and check for num of missing values in single col
import pandas as pd
# Read in delimited file, setting delimiter, and keeping only single col of interest
df = pd.read_table("StanfordUniversity_TAX_201906_IL.txt", delimiter="|", usecols=["YEAR BUILT"])
# Check unique values
df["YEAR BUILT"].unique()
# Count the number of null/NaN values
df["YEAR BUILT"].isnull().sum()