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
require "json" | |
require "http/server" | |
server = HTTP::Server.new do |context| | |
environment = Hash.zip(ENV.keys, ENV.values) | |
context.response.content_type = "application/json" | |
context.response.print environment.to_json | |
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
def handle_platypus(args): | |
pass | |
def handle_dog(args): | |
pass | |
def handle_cat(args): | |
pass | |
def fallback(args): |
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'] |