Skip to content

Instantly share code, notes, and snippets.

@ctufts
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: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
@ctufts
ctufts / spacy-snippets.md
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
ctufts / docker_notes.md
Last active July 13, 2021 18:41
Notes on docker

Docker notes:

General

Images - Stopped containers Containers - running containers

Commands

@ctufts
ctufts / Helpful_Python.py
Created May 25, 2018 18:11
Helpful Python Snippets
# select n items from a dict
from itertools import islice
def take(n, iterable):
"Return first n items of the iterable as a list"
return list(islice(iterable, n))
n = 5
for k,v in take(n, dictionary.items()):
print(k,v)
@ctufts
ctufts / WindowsCLI.md
Last active May 15, 2018 12:48
Windows CLI
  • dir : list all files and directories (equivalent of ls)
  • dir /od /n : /od is sorted (o) by date (d)
  • cls : clear terminal
  • <escape key> : clears current line from terminal, similar to ctrl + u on linux
  • <home key> : go to beginning of current string in the terminal, peforms same function as ctrl + a on linux
  • <end key> : got to end of current string in the terminal, similar to ctrl + e on linux
  • __ : view all command history in terminal
@ctufts
ctufts / index.html
Last active July 9, 2017 23:23
coin flip example
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
@ctufts
ctufts / Error_list.md
Created April 12, 2017 18:24
List of different error metrics

List of metrics First Tier:

  • False Positive - Type I
  • False Negative - Type II
  • True Positive
  • True Negative

Second Tier: Primary issues with 2nd tier - not easy to remember and have various names for the same thing: is there a way to prevent this, i.e. create some type of

@ctufts
ctufts / text_transistion.js
Last active April 6, 2017 13:19
function for crossfade transition of text using d3 based on this block: https://bl.ocks.org/mbostock/f7dcecb19c4af317e464
function transition_text(element_id, display_text, t_duration){
// base off of https://bl.ocks.org/mbostock/f7dcecb19c4af317e464
svg.select(element_id)
.transition()
.duration(t_duration)
.on("start", function () {
var t = d3.active(this)
.style("opacity", 0)
.remove();
@ctufts
ctufts / .block
Last active March 24, 2017 20:31
Force Layout - Point-Along-Path - State Diagram Animation
license: gpl-3.0