Skip to content

Instantly share code, notes, and snippets.

@ericbusboom
ericbusboom / anscombes.csv
Last active September 3, 2021 18:03
Anscombe's Quartet Data
id dataset x y
0 I 10.0 8.04
1 I 8.0 6.95
2 I 13.0 7.58
3 I 9.0 8.81
4 I 11.0 8.33
5 I 14.0 9.96
6 I 6.0 7.24
7 I 4.0 4.26
8 I 12.0 10.84
def get_group_file(self, srs, name, path):
import ogr, os
drv = ogr.GetDriverByName( "SQLite" )
options = ['SPATIALITE=YES', 'INIT_WITH_EPSG=YES','OGR_SQLITE_SYNCHRONOUS=OFF']
if os.path.exists(path):
os.remove(path)
ds = drv.CreateDataSource(path, options=options)
@ericbusboom
ericbusboom / certgen.rb
Created November 9, 2015 16:54 — forked from sheerun/certgen.rb
Docker TLS certificate generator
# Generates necessary certificates to ~/.docker
#
# Usage:
# bundle install
# ruby certgen.rb <domain>
require 'certificate_authority'
require 'fileutils'
if ARGV.empty?
@ericbusboom
ericbusboom / row_gen_for_source
Last active August 29, 2015 14:23
row_gen_for_source
def row_gen_for_source(self, source_name, use_row_spec = True):
source = self.metadata.sources[source_name]
fn = self.filesystem.download(source_name)
if fn.endswith('.zip'):
sub_file = source.file
fn = self.filesystem.unzip(fn, regex=sub_file)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ericbusboom
ericbusboom / cache_url.py
Last active August 29, 2015 14:04
cache_url function
import requests
def cache_url(url):
"""Load a url to a local file, or return the file path if it already exists
This function will download the given URL to the current directory, with a file name of the
last path element in the URL. """
import os
import urlparse
from IPython.display import display, clear_output
import sys
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.