Skip to content

Instantly share code, notes, and snippets.

import os
import warc
import math
from urlparse import urlparse
def get_failed_url_counts(links):
"""
## counting failed sites
this can be done in perma prod, easiest way to get to link model
"""

Keybase proof

I hereby claim:

  • I am anastasia on github.
  • I am aizman (https://keybase.io/aizman) on keybase.
  • I have a public key whose fingerprint is CF13 3AF0 5C8D 0925 C9CE 1C36 A0A3 9556 3DB7 0BF8

To claim this, I am signing this object:

@anastasia
anastasia / parse_excel.py
Last active July 1, 2016 17:27
parse excel book for repeated values
import xlrd
import csv
import operator
import sys
def get_sums():
book_name = sys.argv[1]
col = sys.argv[2]
sorted_filename = sys.argv[3]
format_str = sys.argv[4] if len(sys.argv) >= 4 else False
@anastasia
anastasia / internet_archive_check.txt
Created June 23, 2016 18:08
An internet archive check, archives from 3–2 days ago
{u'4MWH-KGXF': {'perma_url': True, 'description': True, 'title': True, 'external-identifier': True, 'mediatype': True, 'collection': True, 'submitted_url': True, 'error': SSLError(u'Error retrieving metadata from https://archive.org/metadata/perma_cc_8BQN-MZ68, ("bad handshake: SysCallError(104, \'ECONNRESET\')",)',), 'contributor': True, 'organization': True, 'uploaded_file': True}, u'P83X-5MAS': {'perma_url': True, 'description': True, 'title': True, 'external-identifier': True, 'mediatype': True, 'collection': True, 'submitted_url': True, 'error': SSLError(u'Error retrieving metadata from https://archive.org/metadata/perma_cc_8BQN-MZ68, ("bad handshake: SysCallError(104, \'ECONNRESET\')",)',), 'contributor': True, 'organization': True, 'uploaded_file': True}, u'DX4E-4BZ5': {'perma_url': True, 'description': True, 'title': True, 'external-identifier': True, 'mediatype': True, 'collection': True, 'submitted_url': True, 'error': SSLError(u'Error retrieving metadata from https://archive.org/metadata/perma_cc_8
@anastasia
anastasia / gist:f8f0c08099d3c826040d
Created October 24, 2014 19:28
An object with all 16:9 pairs
var findPairs = function() {
var height;
var numPairs = {};
var width = 450;
while (width <= 1280) {
height = width * 9 / 16;
if (!(height % 1) ){
numPairs[width] = height;
}
width += 1;
@anastasia
anastasia / gist:dc19c91e56fb7ef23fcb
Last active August 29, 2015 14:02
Get ordered-by-z-index list of jQuery objects
var orderZlist = function(){
var zIndexArray = [];
$.each($('*'), function(key, value) {
var index_current = parseInt($(this).css("z-index"), 10);
if (index_current){
zIndexArray.push({elem:value, z: index_current});
}
});
zIndexArray.sort(function(a,b){
if(a.z > b.z){return 1}