Skip to content

Instantly share code, notes, and snippets.

ctufts / group_by_and_ggplot.R
Created July 11, 2016 19:56
dplyr group_by and ggplot example
plot_df <-df %>% group_by(feature) %>%
plots = ggplot(data = .) + aes(x = xcol, y = ycol) +
geom_point() + ggtitle(.$feature)
# show plots
ctufts / General Conda
Last active January 3, 2024 03:36
List of commonly used commands in anaconda
  • conda info --envs : lists all environments
  • source activate <env name>: activate an environment
  • source deactivate: deactivate an environment
  • conda list : list all packages installed
  • conda create --name <env name> python=3 astroid babel : create new environment, specify version of python, and install packages
  • WINDOWS NOTE: SOURCE is not recognized. When deactivating and activating in the anaconda command prompt, skip source and just type deactivate or activate depending on what you are trying to do.
  • conda env export > environment.yml: export conda environment requirements list to a file
  • conda env remove -n ENV_NAME : delete environment
ctufts / .block
Last active June 21, 2023 21:26
Clustered Force Layout Bubble Chart
license: gpl-3.0
height: 500
border: yes
ctufts /
Last active March 1, 2023 20:09
Common linux commands

Ubuntu Linux

  • sudo -i : elevate to super user
  • du : get breakdown of memory usage of all subdirectories
  • df -h : get breakdown of memory usage on disk
  • ls -a : show all files in directory (including hidden files)
  • rsync : copy files from one server to another (similar to scp but more functionality)
    • Set up rsync with sudo
    • rsync -az -e "ssh" --rsync-path="sudo rsync" user@servername:/pulled-source-directory /local-directory/
    • rsync [source] [destination]
ctufts / launch.json
Created April 12, 2022 12:47
VSCode Debug Config for Debugging Streamlit Application (Python)
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit:
"version": "0.2.0",
"configurations": [
"name": "Python: Current File",
"type": "python",
"request": "launch",
ctufts /
Created January 27, 2022 18:34
Spacy Snippets

View entities of a list of docs:

doc = nlp("George Washington was the first president of the United States.")

for ent in doc.ents:
    print("entity: ", ent.text, " : ", ent.label_)
ctufts / .block
Last active October 19, 2021 21:13
Glycemic Load Per Serving Visualization
license: gpl-3.0
ctufts /
Last active July 13, 2021 18:41
Notes on docker

Docker notes:


Images - Stopped containers Containers - running containers


ctufts /
Last active July 8, 2019 01:37
The script creates a twitter stream listener using Tweepy then stores the data in a MySQL database. The code works with Python 3 and will also support emoji ( utf8mbr4 encoding ).
# code for streaming twitter to a mysql db
# for Python 3 and will support emoji characters (utf8mb4)
# based on the Python 2 code
# supplied by
# for further information on how to use python 3, twitter's api, and
# mysql together visit:
from tweepy import Stream
from tweepy import OAuthHandler
ctufts / .block
Last active April 15, 2019 23:12
D3 Scatterplot with Regression Line
license: gpl-3.0
height: 500
scrolling: no
border: no