Skip to content

Instantly share code, notes, and snippets.

@mtigas
mtigas / 0.txt
Last active December 21, 2015 21:39 — forked from veltman/gist:6369472
-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
@mtigas
mtigas / twitter_ebook.py
Last active December 11, 2015 06:48 — forked from argv0/gist:3627514
oh god what have i done
"""
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
@mtigas
mtigas / gist:1304751
Created October 21, 2011 19:44 — forked from ryanpitts/gist:1304725
GROUP BY and Select MAX from each group in Django, 2 queries
'''
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.
'''
@mtigas
mtigas / install_homebrew.rb
Created July 15, 2011 22:27 — forked from mxcl/install_homebrew.markdown
Installs Homebrew to /usr/local so you don't need sudo to `brew install`
#!/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
@mtigas
mtigas / gist:1007030
Created June 3, 2011 19:45 — forked from n0nick/gist:1006549
wget-1.12-subjectAltNames.diff
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>
#!/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.
@mtigas
mtigas / logging.py
Created November 18, 2010 21:01 — forked from tkaemming/logging.py
from reviewgallery.settings.development.defaults import *
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'default': {
'format': '%(name)s-%(levelname)s -- %(message)s'
}
},
@mtigas
mtigas / gist:219443
Created October 27, 2009 09:55 — forked from tkaemming/gist:94302
.zshrc
# .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}]%}'
@mtigas
mtigas / gini-1.py
Last active August 29, 2015 14:01 — forked from esagara/gini.py
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)