Skip to content

Instantly share code, notes, and snippets.

@westurner
westurner / cinst_workstation_minimal.ps1
Last active March 2, 2021 11:08
PowerShell script to install a minimal Workstation with Chocolatey
### PowerShell script to install a minimal Workstation with Chocolatey
# https://chocolatey.org
## To Run This Script:
# 1. Download this PowerShell script
# * Right-click <> ("View Raw") and "Save As" to %USERPROFILE% (/Users/<username>)
# * If Cocolatey is not already installed, see
# "Uncomment to install Chocolatey"
# * If you would like to also install Anaconda
# (Python, IPython, lots of great libraries)
$ time python ./test_islice_performance.py
===============================================================================
# PERF justification for https://github.com/pydata/pandas/issues/6700
# 1000 times
# -10% = 10% speedup
# 20% = 20% slowdown
-------------------------------------------------------------------------------
def get_data(n=100000):
return ((x, x*20, x*100) for x in xrange(n))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@westurner
westurner / broadband_cap.py
Last active August 29, 2015 13:57
Calculate time to reach broadband cap with specified bandwidth speeds
#!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
from __future__ import division
"""
broadband_cap
==============
Calculate time to reach broadband cap with specified bandwidth speeds
Usage::
@westurner
westurner / imgcomp.py
Created November 27, 2013 06:48
Recompress an image with PIL a number of times.
#!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
"""
imgcomp -- [re]compress an image multiple times, saving intermediate output
* https://en.wikipedia.org/wiki/JPEG
* https://en.wikipedia.org/wiki/Generation_loss
"""
@westurner
westurner / README.rst
Last active December 18, 2015 01:29
Draft 00: HTTP Problem JSON Object --> HTTP Problem RDFS/OWL Ontology in Turtle
#!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
"""
parse_editable_url
"""
import urllib
import urlparse
import logging
@westurner
westurner / rst_shift.py
Created September 16, 2012 23:21
ReStructuredText Heading Shift
#!/usr/bin/env python
"""
A utility for modifying ReStructuredText headings by the
specified shift offset.
For example::
==========
Title
==========
@westurner
westurner / gist:3723284
Created September 14, 2012 17:08
To Remember
from pandas import DataFrame, Series, Index
N = 1.7
index2 = Index(range(0,200))
uhh = [(n**N) for n in index2[:95]]
uhh.extend( (n**(-N)) for n in index2[95:100] )
uhh.extend( uhh )
series = Series(uhh, index=index2)
uhh2 = uhh[:95]
uhh2.extend( (uhh[-6],)*5 )
@westurner
westurner / mobile_voice_data.py
Last active October 10, 2015 17:08
Mobile data/voice cost comparison
AMR = {'12.20':12.20}
def calculate_data_mb(minutes=10, kbps=AMR['12.20']):
seconds = minutes*60
kilobits = (kbps*seconds) / 8.0
mb = float(kilobits) / 1024.0
return mb
def data_transfer_in_minutes(transfergb=0.134, kbps=AMR['12.20']):
gbits = transfergb * 1024**3 * 8.0