Skip to content

Instantly share code, notes, and snippets.

View lizadaly's full-sized avatar

Liza Daly lizadaly

View GitHub Profile
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

def shannon_entropy(img):
# calculate the shannon entropy for an image
histogram = img.histogram()
histogram_length = sum(histogram)
samples_probability = [float(h) / histogram_length for h in histogram]
return -sum([p * math.log(p, 2) for p in samples_probability if p != 0])
@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)

@tr00st
tr00st / switch_to_python3.4.sh
Last active May 19, 2022 14:40
DO NOT USE: OUT OF DATE & UNMAINTAINED - Python 3 upgrade script for the Django image on DigitalOcean
#!/bin/bash
#
# Copyright 2015 James Cheese
# You may do anything with this work that copyright law would normally
# restrict, so long as you retain the above notice(s) and this license
# in all redistributed copies and derived works. There is no warranty.
#
# Python 3 Upgrade for Django Droplet
# Will update the "Django on 14.04" Digital Ocean image.
# Run as root.