Skip to content

Instantly share code, notes, and snippets.

View anemitz's full-sized avatar

Anthony N anemitz

View GitHub Profile
@anemitz
anemitz / gist:8cc6ef6c41ea4cefe51a13fbd6d8676a
Created April 21, 2016 13:22
Google Sheets Fetch JSON with Authentication
function ImportJSONBasicAuthentication(url, query, parseOptions, username, password) {
var fetchOptions = {
"headers" : {
"Authorization" : 'Basic ' + Utilities.base64Encode(username + ':' + password)
},
muteHttpExceptions: true
};
return ImportJSONAdvanced(url, fetchOptions, query, parseOptions, includeXPath_, defaultTransform_);
@anemitz
anemitz / gist:29f8401a42de3b50c58e
Created June 1, 2015 17:11
A2 Country ISO Mappings
United States, United States of America, 'Merica, USA, U.S. => US
United Kingdom, UK, England => GB
Canada => CA
Germany, Deutschland => DE
France => FR
Afghanistan => AF
Åland Islands => AX
Albania => AL
Algeria => DZ
American Samoa => AS

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@anemitz
anemitz / gist:7558979
Created November 20, 2013 07:11
Deletes the 'owner' custom field for a given search query
#!/usr/bin/env python
import argparse
from closeio_api import Client as CloseIO_API
parser = argparse.ArgumentParser(description='Search and update some leads')
parser.add_argument('--api_key', '-k', required=True, help='API Key')
args = parser.parse_args()
api = CloseIO_API(args.api_key)
@anemitz
anemitz / drip_email.py
Created August 24, 2013 00:07
Send drip-style email through Close.io's API
#!/usr/bin/env python
import sys
import time
import codecs
import argparse
from pybars import Compiler
from closeio_api_client.api import CloseIO_API as CloseIO
#!/usr/bin/env python
import csv
import argparse
from flask_common.utils import CsvWriter
from closeio_api_client.api import CloseIO_API, APIError
HEADERS = ['display_name', 'addresses']
parser = argparse.ArgumentParser(description='Export Leads to CSV')
parser.add_argument('--api_key', '-k', required=True, help='API Key')
@anemitz
anemitz / opportunities_to_csv.py
Created July 31, 2013 05:53
Close.io Opportunities to CSV
#!/usr/bin/env python
import csv
import argparse
from flask_common.utils import CsvWriter
from closeio_api_client.api import CloseIO_API, APIError
HEADERS = ['date_created', 'lead_name', 'status', 'date_won', 'date_lost', 'confidence', 'user_name', 'note', 'value', 'value_period']
parser = argparse.ArgumentParser(description='Export Opportunities to CSV')
parser.add_argument('--api_key', '-k', required=True, help='API Key')
@anemitz
anemitz / gist:3447499
Created August 24, 2012 08:31
MongoEngine DocumentBase
import datetime
from mongoengine import *
class DocumentBase(Document):
date_created = DateTimeField()
date_updated = DateTimeField()
def _type(self):
return unicode(self.__class__.__name__)
@anemitz
anemitz / gist:3447356
Created August 24, 2012 08:09
MongoEngine RandomPKDocument
import os
from zbase62 import zbase62
from mongoengine import *
from mongoengine.queryset import OperationError
class RandomPKDocument(Document):
id = StringField(unique=True, primary_key=True)
def get_pk_prefix(self):
@anemitz
anemitz / slaballoc_design
Created March 1, 2012 04:01
Slab Alloc
Design:
Note: The smallest block that can be allocated is 8 bytes due to the following structure.
Byte Layout:
0 3 7
----------------------------
| size of | offset to |
| data | next free |
----------------------------