Skip to content

Instantly share code, notes, and snippets.

package autohunt;
import java.util.ArrayList;
import java.util.HashMap;
import java.io.File;
import java.io.IOException;
import java.awt.Rectangle;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.Graphics;
from __future__ import annotations
import argparse
import time
from copy import copy
from threading import Lock, Thread, local
from typing import Iterator, Literal
DB = {
"A": 10,
"""
MIT License
Copyright (c) 2023 Ryan Siemens
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@rsiemens
rsiemens / jsonlite.py
Last active October 5, 2019 20:41
A toy recursive decent parser for a JSON subset called "JSON Lite"
"""
Grammar
JSON = "{" FIELD "}"
FIELD = ε | FIELDS
FIELDS = STRING ":" VALUE ("," FIELDS)*
VALUE = STRING | JSON
STRING = "\"" PRINTABLE "\""
PRINTABLE = (a | .. | z | A | .. | Z | 0 | .. | 9)*
"""
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.TextField.extend({
type: 'number',
_value: null,
value: Ember.computed({
get(_) { return this.get('_value'); },
set(_, v) { return this.set('_value', parseInt(v)); }
})
});
@rsiemens
rsiemens / beautiful_idiomatic_python.md
Created September 9, 2016 15:26 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]: