This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
def gini(population): | |
""" | |
https://en.wikipedia.org/wiki/Gini_coefficient#Calculation | |
see "This may be simplified to:" | |
""" | |
pop = sorted(population) | |
n = len(pop) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-Step 1: basic HTML skeleton for a full-screen map | |
-Step 2: initialize a map | |
-Step 3: add a tile layer | |
-Step 4: Add a marker | |
-Step 5: Add a line | |
-Step 6: Add a polygon | |
-Step 7: Styling: add a polygon with different styling | |
-Step 8: Click/hover | |
-On click, re-center map | |
-On hover, change styling of polygon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
usage: twitter_ebook.py [-h] [--num NUM] archive_dir | |
Generate some tweets based on the CSV in a Twitter archive download | |
positional arguments: | |
archive_dir path your unzipped Twitter archive | |
optional arguments: | |
-h, --help show this help message and exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
given a Model with: | |
category = models.CharField(max_length=32, choices=CATEGORY_CHOICES) | |
pubdate = models.DateTimeField(default=datetime.now) | |
<other fields> | |
Fetch the item from each category with the latest pubdate. | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# This script installs to /usr/local only. To install elsewhere you can just | |
# untar https://github.com/mxcl/homebrew/tarball/master anywhere you like. | |
# | |
# | |
# 30th March 2010: | |
# Added a check to make sure user is in the staff group. This was a problem | |
# for me, and I think it was due to me migrating my account over several | |
# versions of OS X. I cannot verify that for sure, and it was tested on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/openssl.c b/src/openssl.c | |
index b55ca8b..b036a3b 100644 | |
--- a/src/openssl.c | |
+++ b/src/openssl.c | |
@@ -39,7 +39,7 @@ as that of the covered work. */ | |
#include <string.h> | |
#include <openssl/ssl.h> | |
-#include <openssl/x509.h> | |
+#include <openssl/x509v3.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# usat_import | |
# Fork by Mike Tigas | |
# Based on work by Ryan Nagle, Chris Groskopf and Brian Boyer | |
# | |
# Updated to allow import of multiple states into the same database. | |
# Unlike the original script, this *only* generates super-wide tables. | |
# | |
# Shapes are stored in WGS84 (EPSG:4326) for portability. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from reviewgallery.settings.development.defaults import * | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': True, | |
'formatters': { | |
'default': { | |
'format': '%(name)s-%(levelname)s -- %(message)s' | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .zshrc | |
alias lstree="ls -R | grep \":$\" | sed -e 's/:$//' -e 's/[^-][^\/]*\//–/g' -e 's/^/ /' -e 's/-/|/'" | |
autoload colors zsh/terminfo | |
if [[ "$terminfo[colors]" -ge 8 ]]; then | |
colors | |
fi | |
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do | |
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' |