Skip to content

Instantly share code, notes, and snippets.

@jexp
jexp / trumpworld-detailed.adoc
Last active March 27, 2019 02:54
More detailed Neo4j Import of TrumpWorld from Buzzfeed https://www.buzzfeed.com/johntemplon/help-us-map-trumpworld

The TrumpWorld Graph

@julienr
julienr / sklearn_classif_report_to_latex.py
Created October 26, 2015 16:04
Parse and convert scikit-learn classification_report to latex
"""
Code to parse sklearn classification_report
"""
##
import sys
import collections
##
def parse_classification_report(clfreport):
"""
Parse a sklearn classification report into a dict keyed by class name
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@thatalextaylor
thatalextaylor / 1-python-pretty-time-delta.py
Last active November 5, 2023 22:48
Pretty print a time delta in Python in days, hours, minutes and seconds
def pretty_time_delta(seconds):
sign_string = '-' if seconds < 0 else ''
seconds = abs(int(seconds))
days, seconds = divmod(seconds, 86400)
hours, seconds = divmod(seconds, 3600)
minutes, seconds = divmod(seconds, 60)
if days > 0:
return '%s%dd%dh%dm%ds' % (sign_string, days, hours, minutes, seconds)
elif hours > 0:
return '%s%dh%dm%ds' % (sign_string, hours, minutes, seconds)

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: