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
class StochasticHash | |
attr_accessor :data | |
def initialize(data) | |
@data = data | |
end | |
def total | |
@total ||= data.values.sum | |
end |
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 datetime import datetime, timezone | |
import json | |
import re | |
import peewee | |
from playhouse import postgres_ext, fields | |
from playhouse.fields import PasswordField as PWDField | |
from postgis import Point | |
from psycopg2.extras import DateTimeTZRange |
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
query TotalFarmOverview($year: Int!) { | |
getTotalFarmOverview(year: $year) { | |
marketedCrops { | |
...MarketedCropBasic | |
__typename | |
} | |
overview { | |
totalCoverage | |
targetCostAndProfit | |
bookedRevenue |
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
{ | |
"auto_complete": false, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/User/Made of Code (Flake8Lint).tmTheme", | |
"ensure_newline_at_eof_on_save": true, | |
"file_exclude_patterns": | |
[ | |
"*.pyc", | |
"*.pyo", | |
"*.exe", |
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
import operator | |
class LeastUsed(object): | |
""" | |
Class that stores a list of items. | |
When an item is requested, that item is considered to have been 'used' | |
Each time an item is requested, request the one that has been used the least. |
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
def fib(): | |
x = 0 | |
y = 1 | |
while True: | |
yield x | |
x, y = y, x + y | |
def take(n, coll): |
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
import sys | |
import cProfile | |
import pstats | |
from functools import wraps | |
from contextlib import contextmanager | |
@contextmanager | |
def profile(): |
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
def arange(start, end): | |
"""alphanumeric range, inclusive""" | |
return (chr(i) for i in range(ord(start), ord(end) + 1)) | |
>>> arange('A', 'B') | |
<generator object arange.<locals>.<genexpr> at 0x1047bcbf8> | |
>>> list(arange('A', 'Z')) | |
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] |
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
// Copyright (C) 2016 Comcast Cable Communications, LLC | |
// Contact Us: http://customer.xfinity.com/contact-us/ | |
// Intended use of this message is to display critical and time sensitive notifications to customers. | |
/* | |
This program is free software; you can redistribute it and/or | |
modify it under the terms of the GNU General Public License | |
as published by the Free Software Foundation; either version 2 | |
of the License, or (at your option) any later version. | |
This program is distributed in the hope that it will be useful, |
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
# Description: | |
# For when you miss whalesalad | |
# | |
# Commands: | |
# whalesaid | |
whaleisms = [ | |
"Everything should be generated by code, nothing should be generated by people", | |
"code is data", | |
"code is data, data is just life, blood is just code, code is my blood, i am dead.", |