Skip to content

Instantly share code, notes, and snippets.

@TimothyFitz
TimothyFitz / monkeypatch_aiomysql.py
Created December 6, 2018 15:11
Monkeypatch my asyncio fix until 0.0.20 releases.
import asyncio
from aiomysql.pool import Pool, connect
def patch_pool():
"""Monkey patch until aiomysql fixes this bug"""
Pool._fill_free_pool = _fill_free_pool
# Only change from aiomysql's implementation is to check the reader's exception in addition to at_eof.
Sep 06 11:48:35 internal-2jk0 gunicorn[24796]: [2018-09-06 11:48:35,581] ERROR in app: Exception on /scrape [POST]
Sep 06 11:48:35 internal-2jk0 gunicorn[24796]: Traceback (most recent call last):
Sep 06 11:48:35 internal-2jk0 gunicorn[24796]: File "/home/findmine/monolith/database/mysql/handle.py", line 56, in fetch
Sep 06 11:48:35 internal-2jk0 gunicorn[24796]: await cur.execute(query, params)
Sep 06 11:48:35 internal-2jk0 gunicorn[24796]: File "/home/findmine/virtualenv/lib/python3.5/site-packages/aiomysql/cursors.py", line 240, in execute
Sep 06 11:48:35 internal-2jk0 gunicorn[24796]: yield from self._query(query)
Sep 06 11:48:35 internal-2jk0 gunicorn[24796]: File "/home/findmine/virtualenv/lib/python3.5/site-packages/aiomysql/cursors.py", line 461, in _query
Sep 06 11:48:35 internal-2jk0 gunicorn[24796]: yield from conn.query(q)
Sep 06 11:48:35 internal-2jk0 gunicorn[24796]: File "/home/findmine/virtualenv/lib/python3.5/site-packages/aiomysql/connection.py", line 409, in query
Sep 06
@TimothyFitz
TimothyFitz / findmine_adidas_unisex_item.txt
Last active May 29, 2018 19:28 — forked from fpetelin/findmine_adidas_unisex_item.txt
FINDMINE adidas unisex item match/sets POST call
POST /api/v1.1/match/sets?branded=1&teamed=1&sported=1 HTTP/1.0
Host: www.findmine.com
Content-Type: application/json
Referer: https://www.adidas.com/us/superstar-shoes/C77124.html
Origin: www.adidas.com
Cache-Control: no-cache
{
"app_id": "6A7C59CA5DA6F731107", // Adidas U. For Adidas West EU use "247ED3F118070FF0BBE3",
"url": "https://www.adidas.com/us/superstar-shoes/C77124.html",
PROCESS:
Create in Qubicle.
Paint dissimilar things unique colors (each unique color will become a new mask).
Export FBX. Texture, Non-Manifold, As Specified. Scale factor 5
Run generate-masks.py on the material's png file.
Will generate one mask per unique color in the input file, output to material-color.png
@TimothyFitz
TimothyFitz / gist:3a14723fb138c4664b38125f247db0fe
Last active December 22, 2017 21:20
Hack to get up to 15 dynamicly changing colors in a single PicaVoxel model
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv1 = v.texcoord1;
o.uv2 = v.texcoord2;
float4 color = v.vertexColor;
uint index = ceil(color.a * 15);
if (index < 15) {
color = _ColorReplace[index];
}
o.vertexColor = color; // v.vertexColor;

Keybase proof

I hereby claim:

  • I am timothyfitz on github.
  • I am timothyfitz (https://keybase.io/timothyfitz) on keybase.
  • I have a public key ASAJjk1DBOr7i6A_d5PfuDtUjBrL0HS1KkA6Yi9VI0aSPwo

To claim this, I am signing this object:

class Foo extends Array {}
var a = new Array();
a[0] = "bar";
console.log(a.length); // 1
var f = new Foo();
f[0] = "bar";
console.log(f.length); // 0, when I expect this to be 1
using UnityEngine;
public class Util
{
static public T Choice<T>(T[] choices) {
// Why is Random.value [0,1] and not [0,1) like every other library? Or why isn't there a [0,1) variant?
return choices.Length > 0 ? choices[Mathf.FloorToInt(Random.value * 0.99999999f * choices.Length)] : default(T);
}
static public Vector2 PerpendicularCW(Vector2 vec) {
using UnityEngine;
using System.Collections;
public class Crawler : MonoBehaviour {
public Sprite[] frames;
void Start () {
StartCoroutine(Loop());
}
description "upstart configuration for rails server"
start on startup
stop on shutdown
setuid ubuntu
setgid ubuntu
respawn