Skip to content

Instantly share code, notes, and snippets.

@ctufts
ctufts / General Conda Commands.md
Last active July 4, 2023 17:04
List of commonly used commands in anaconda
View General Conda Commands.md
  • 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
ctufts / .block
Last active June 21, 2023 21:26
Clustered Force Layout Bubble Chart
View .block
license: gpl-3.0
height: 500
border: yes
@ctufts
ctufts / LinuxCommands.md
Last active March 1, 2023 20:09
Common linux commands
View LinuxCommands.md

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
ctufts / launch.json
Created April 12, 2022 12:47
VSCode Debug Config for Debugging Streamlit Application (Python)
View launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
@ctufts
ctufts / group_by_and_ggplot.R
Created July 11, 2016 19:56
dplyr group_by and ggplot example
View group_by_and_ggplot.R
plot_df <-df %>% group_by(feature) %>%
do(
plots = ggplot(data = .) + aes(x = xcol, y = ycol) +
geom_point() + ggtitle(.$feature)
)
# show plots
plot_df$plots
@ctufts
ctufts / spacy-snippets.md
Created January 27, 2022 18:34
Spacy Snippets
View spacy-snippets.md

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
ctufts / .block
Last active October 19, 2021 21:13
Glycemic Load Per Serving Visualization
View .block
license: gpl-3.0
@ctufts
ctufts / docker_notes.md
Last active July 13, 2021 18:41
Notes on docker
View docker_notes.md
@ctufts
ctufts / twitterStream_to_mysql.py
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 ).
View twitterStream_to_mysql.py
# 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 http://pythonprogramming.net/twitter-api-streaming-tweets-python-tutorial/
# for further information on how to use python 3, twitter's api, and
# mysql together visit: http://miningthedetails.com/blog/python/TwitterStreamsPythonMySQL/
from tweepy import Stream
from tweepy import OAuthHandler
@ctufts
ctufts / .block
Last active April 15, 2019 23:12
D3 Scatterplot with Regression Line
View .block
license: gpl-3.0
height: 500
scrolling: no
border: no