Skip to content

Instantly share code, notes, and snippets.

@jagill
jagill / geometry-typestate.rs
Created July 14, 2020 12:29
Using typestate to statically check valid/prepared status for geometries
use crate::SegRTree;
use crate::{Coordinate, Rectangle};
#[derive(Debug)]
struct ValidationError;
#[derive(Debug)]
struct RingError;
// STATE
POLYGON ((-79.7450000000000045 32.8400000000000034, -79.7300000000000040 32.8400000000000034, -79.7288448999999986 32.8382823000000030, -79.7270325000000071 32.8323201999999981, -79.7269957000000034 32.8320999999999970, -79.7269265000000047 32.8319647000000003, -79.7268492999999978 32.8318738999999979, -79.7268452999999937 32.8317048999999983, -79.7268337000000002 32.8315417000000025, -79.7267664000000025 32.8313592000000014, -79.7267915999999985 32.8311232000000004, -79.7266943000000055 32.8307564999999997, -79.7266920999999940 32.8305892999999998, -79.7266834999999929 32.8304589999999976, -79.7266943000000055 32.8302741999999981, -79.7267032999999969 32.8301608000000016, -79.7266543000000070 32.8299331999999993, -79.7291239999999988 32.8298295000000024, -79.7303481999999946 32.8259316999999982, -79.7307530000000071 32.8254675000000020, -79.7308311000000032 32.8255059000000031, -79.7309419000000048 32.8255388999999980, -79.7310331000000048 32.8255553999999989, -79.7316256000000010 32.8256706000000023, -79.73
0 $ python train.py
WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype.
WARN: You are calling 'step()' even though this environment has already returned done = True. You should always call 'reset()' once you receive 'done = True' -- any further steps are undefined behavior.
Exception ignored in: <function Viewer.__del__ at 0x119f546a8>
Traceback (most recent call last):
File "/Users/jagill/.envs/gym/lib/python3.7/site-packages/gym/envs/classic_control/rendering.py", line 143, in __del__
File "/Users/jagill/.envs/gym/lib/python3.7/site-packages/gym/envs/classic_control/rendering.py", line 62, in close
File "/Users/jagill/.envs/gym/lib/python3.7/site-packages/pyglet/window/cocoa/__init__.py", line 281, in close
File "/Users/jagill/.envs/gym/lib/python3.7/site-packages/pyglet/window/__init__.py", line 770, in close
ImportError: sys.meta_path is None, Python is likely shutting down
@jagill
jagill / editor-0df1847531833806dd71e863147724f10f937e15
Created December 9, 2014 04:31
Storage file for bug in atom
{"mode":"editor","version":1,"windowDimensions":{"x":1975,"y":-439,"width":1998,"height":1112,"maximized":false},"grammars":{"deserializer":"GrammarRegistry","grammarOverridesByPath":{}},"project":{"paths":["/Users/jag/euler"],"buffers":[{"text":"# coding: utf8\n\n'''\nTriangle, pentagonal, and hexagonal numbers are generated by the following\nformulae:\n\nTriangle\t \tTn=n(n+1)/2\t \t1, 3, 6, 10, 15, ...\nPentagonal\t \tPn=n(3n−1)/2\t \t1, 5, 12, 22, 35, ...\nHexagonal\t \tHn=n(2n−1)\t \t1, 6, 15, 28, 45, ...\nIt can be verified that T285 = P165 = H143 = 40755.\n\nFind the next triangle number that is also pentagonal and hexagonal.\n'''\n\ndef triangle(n):\n return n*(n+1)/2\n\ndef pentagonal(n):\n return n*(3*n-1)/2\n\ndef hexagonal(n):\n return n*(2*n - 1)\n\n\ncurrentTn = 0\ncurrentT = 0\n\ncurrentPn = 0\ncurrentP = 0\n\ni = 0\nwhile True:\n i += 1\n h = hexagonal(i)\n while currentT < h:\n currentTn += 1\n currentT = triangle(currentTn)\n while currentP < h:\n cu
@jagill
jagill / gist:8ff45414c9ad640a409a
Last active August 29, 2015 14:07
Listener tech spec
/*
* A Listener has four states: stopped, listening, continuous (listening), and stopping.
* (we'll handling pending/not-supported later).
* It starts off as stopped. It can be started normally, or in continuous mode.
*
* Listener Methods
* ================
*
* Listener.start (normal):
* listener.continous = false
@jagill
jagill / longlinebug.js
Created September 10, 2014 17:38
Example of syntax highlighting bug for long lines in atom's javascript package
var languageTags6391To6392 = {'ab':'abk','aa':'aar','af':'afr','sq':'sqi','am':'amh','ar':'ara','an':'arg','hy':'hye','as':'asm','ae':'ave','ay':'aym','az':'aze','ba':'bak','eu':'eus','be':'bel','bn':'ben','bh':'bih','bi':'bis','bs':'bos','br':'bre','bg':'bul','my':'mya','ca':'cat','ch':'cha','ce':'che','zh':'zho','cu':'chu','cv':'chv','kw':'cor','co':'cos','hr':'hrv','cs':'ces','da':'dan','dv':'div','nl':'nld','dz':'dzo','en':'eng','eo':'epo','et':'est','fo':'fao','fj':'fij','fi':'fin','fr':'fra','gd':'gla','gl':'glg','ka':'kat','de':'deu','el':'ell','gn':'grn','gu':'guj','ht':'hat','ha':'hau','he':'heb','hz':'her','hi':'hin','ho':'hmo','hu':'hun','is':'isl','io':'ido','id':'ind','ia':'ina','ie':'ile','iu':'iku','ik':'ipk','ga':'gle','it':'ita','ja':'jpn','jv':'jav','kl':'kal','kn':'kan','ks':'kas','kk':'kaz','km':'khm','ki':'kik','rw':'kin','ky':'kir','kv':'kom','ko':'kor','kj':'kua','ku':'kur','lo':'lao','la':'lat','lv':'lav','li':'lim','ln':'lin','lt':'lit','lb':'ltz','mk':'mkd','mg':'mlg','ms':'m
@jagill
jagill / findMergedBranches.sh
Last active January 4, 2016 14:29
Find remote branches which have been fully merged into a given branch.
baseBranch=develop
for b in `git branch -r | awk '{print $1}'`; do
numLogs=`git log --oneline $baseBranch..$b | wc -l`;
lastModified=`git show $b | grep "^Date:" | sed 's/^Date:\(.*\)/\1/'`
echo $b : $numLogs : $lastModified;
done | grep " 0 "
@jagill
jagill / gist:7953616
Created December 13, 2013 23:45
Meteor update from 0.6.7-rc0 to 0.6.7-rc1 failure
jag@coati:/tmp$ meteor create --release 0.6.7-rc1 test2
Installing Meteor 0.6.7-rc1:
* Package updates: accounts-ui-unstyled facebook facts github google madewith
meetup meteor mongo-livedata spiderable templating test-in-browser twitter
weibo
Failed to load packages for release 0.6.7-rc1
/Users/jag/.meteor/tools/0b2f28e18b/lib/node_modules/fibers/future.js:206
throw(ex);
@jagill
jagill / Build output
Created December 13, 2013 23:42
My application fails to build when upgrading from Meteor 0.6.6.3 to 0.6.7-rc0.
jag@coati:~/madeye/integration-tests/apogee (develop)$ meteor --settings "$PWD/settings.json" --port $MADEYE_APOGEE_PORT --release 0.6.7-rc0 --raw-logs
=> Using Meteor 0.6.7-rc0 as requested (overriding Meteor 0.6.6.3)
[[[[[ ~/madeye/integration-tests/apogee ]]]]]
iron-router: updating npm dependencies -- connect...
stripe: updating npm dependencies -- stripe...
npm ERR! missing: coffee-script@1.6.3, required by pince@0.0.4
npm ERR! missing: underscore@1.5.2, required by pince@0.0.4
npm ERR! missing: moment@2.4.0, required by pince@0.0.4
@jagill
jagill / test output
Created December 6, 2013 16:02
Test failures for oortcloud/node-ddp-client#master I'm on OS X 10.8.5, with node version 0.8.21
jag@coati:/tmp/node-ddp-client (master)$ npm install && npm test
> ddp@0.3.7 test /private/tmp/node-ddp-client
> ./node_modules/mocha/bin/mocha test
․․․․․․․․․
✖ 4 of 9 tests failed: